Thursday, May 2, 2024
1
rated 0 times [  1] [ 0]  / answers: 1 / hits: 14770  / 2 Years ago, sun, october 23, 2022, 7:16:01

I am trying to move all files in the current directory to the directory GuardDog-CMS. Now all the files are actually identical, but the files in the current directory are more up-to-date. So when I do the move, I also want to make sure it doesn't prompted me with "file already exists" or anything like that. So I try the following:



~/Documents/github/GuardDog-CMS-TEMP/guarddog //current directory
~/Documents/github/GuardDog-CMS //destination directory
mv -v . ../../GuardDog-CMS


But it gives me this error:



mv: rename . to ../../GuardDog-CMS/.: Invalid argument

More From » command-line

 Answers
6

You get invalid argument because you used dot (.). Your command is trying to rename current directory to ../../GuardDog-CMS, but this is impossible because in Unix like systems slashes are not allowed in filenames.



Use * if you want to move everything from the current directory:



mv -v * ../../GuardDog-CMS


If you have hidden files in the current directory, use shopt -s dotglob nullglob command before to move the files.



See also: How do you move all files (including hidden) in a directory to another?


[#28281] Sunday, October 23, 2022, 2 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
skaing

Total Points: 462
Total Questions: 124
Total Answers: 113

Location: Nauru
Member since Thu, Feb 2, 2023
1 Year ago
skaing questions
;