I'm trying to write a command that uses mv to move files two directory levels up.
So if the folder order goes like this: ~/Test/2020-08-01/001/002/file.txt, I want to move file.txt from directory 002 to directory 2020-08-01.
When I type out this command from my home directory mv ~/Test/2020-08-01/001/002/* ../.. I get an error that says: mv: cannot move '/home/user/Test/2020-08-01/001/002/file1.txt' to '../../file1.txt': Permission denied
I don't understand why I'm getting a "Permission denied" error and I don't think it's sudo-related. I also don't want to try sudo in case I mess something up.
If anyone has any insight please let me know. Thank you.
../..actually points to/(try running:realpath ../..) and for that reason you get Permission denied. The command should be:mv ~/Test/2020-08-01/001/002/* ~/Test/2020-08-01ls -ld ../.., or change your directory to~/Test/2020-08-01/001/002before running the commandmv * ../...