Exilepc Posted January 23, 2018 Share Posted January 23, 2018 I was moving 3 tb of files to a new dir, the putty screen was acting up and sent this command "mv /mnt/user/Downloading/downloaded// /mnt/user/TV/*.*" the issue is the double // after /mnt/user/Downloading/downloaded I am looking for the files.... any help would be great Link to comment
pwm Posted January 24, 2018 Share Posted January 24, 2018 Never use an argument with * or ? as last argument to mv or cp. The wild card characters will be expanded into the individual matching names - so your single last argument could be supplied as many arguments to mv. And mv will then use the last name of that expansion as the actual target, while all the other names from that expansion will be seen as additional source names. An example: pwm@iapetus:~/mv-test$ mkdir s1 s2 s3 pwm@iapetus:~/mv-test$ mkdir t1 t2 t3 pwm@iapetus:~/mv-test$ mv s* t* pwm@iapetus:~/mv-test$ ls -lrt total 4 drwxr-xr-x 7 pwm pwm 4096 Jan 24 22:00 t3 pwm@iapetus:~/mv-test$ ls -l t3 total 20 drwxr-xr-x 2 pwm pwm 4096 Jan 24 22:00 s1 drwxr-xr-x 2 pwm pwm 4096 Jan 24 22:00 s2 drwxr-xr-x 2 pwm pwm 4096 Jan 24 22:00 s3 drwxr-xr-x 2 pwm pwm 4096 Jan 24 22:00 t1 drwxr-xr-x 2 pwm pwm 4096 Jan 24 22:00 t2 Notice what happened when the second argument t* got expanded, making mv run as if it had seen the following command: mv s1 s2 s3 t1 t2 t3 So it assumed that s1, s2, s3, t1 and t2 all should be moved into the directory t3. Which is not obvious from the command: mv s* t* Link to comment
Recommended Posts
Archived
This topic is now archived and is closed to further replies.