Hi
I have a shell script to copy a pattern of files from Linux to Windows Filesystem.
When i execute the below command
cp -av TOUT_05-02-13* Windows/Folder
`TOUT_05-02-13-19:02:37.tar.gz' -> `Windows/Folder/SYSOUT_05-02-13-19:02:37.tar.gz'
cp: cannot create regular file `Windows/Folder/TOUT_05-02-13-19:02:37.tar.gz': No such file or directory
Same command with Target Directory of /tmp is successful
cp -av TOUT_05-02-13* /tmp/archive
`TOUT_05-02-13-19:02:37.tar.gz' -> `/tmp/archive/TOUT_05-02-13-19:02:37.tar.gz'
do we need to specify any other flag in this case ?
zaxxon
2
Stupid question by me maybe but what happens with these from where you stand in the actual directory:
ls -la Windows/Folder && touch Windows/Folder/testbla
?
user@server> ls -la Windows/Folder
total 4
drwxr-xr-x 1 MYID root 0 2013-09-10 02:19 .
drwxr-xr-x 1 MYID root 0 2013-09-10 01:57 ..
-rwxr-xr-x 1 MYID root 1645 2013-08-27 04:30 kill-session.log
-rwxr-xr-x 1 MYID root 0 2013-09-10 02:19 test
touch Windows/Folder/testfile
ls -la Windows/Folder/
total 0
drwxr-xr-x 1 MYID root 0 2013-09-10 04:03 .
drwxr-xr-x 1 MYID root 0 2013-09-10 01:57 ..
-rwxr-xr-x 1 MYID root 0 2013-09-10 02:19 test
-rwxr-xr-x 1 MYID root 0 2013-09-10 04:03 testfile
---------- Post updated at 04:10 AM ---------- Previous update was at 04:07 AM ----------
When hit tab 2 times with pattern TOUT-05-01* it expands as below
TOUT_05-01-13-19\:01\:55.tar.gz
Does this delimiters causing the issue ?
cero
4
MS-Windows does not allow filenames with colons.
1 Like
Thank you cero
Could you please suggest any work around in this scenario ?
cero
6
Replace the colon with a allowed character, for example a dot:
#!/bin/bash
for i in TOUT_05-02-13*; do
cp -av $i Windows/Folder/${i//:/.}
done