Why do you move instead of renaming the folder?

March 3, 2018 144 views
Block Storage Debian

Hello, I have 1TB of occupied space, and every time I have to rename the folder, instead of renaming I think it moves it, the last time I made it from the console with mv namefolder newname and it takes more than 8 hours, because it does not rename it it moves it, now I'm doing it from and it's the same, why does it take so long? it's supposed to be renaming not moving

1 Answer

Use this:

mv -T namefolder newfolder

In that case, namefolder will not be moved into newfolder if newfolder is a directory. However, if both namefolder and newfolder are directories and newfolder is empty, namefolder will be renamed to newfolder (and the original newfolder removed). If both are directories and newfolder is non-empty, mv -T will complain.

With -T, namefolder is renamed to newfolder, but without -T, namefolder is moved into the directory pointed to by newfolder.

Have another answer? Share your knowledge.