Copy files with pattern from ext4 to cifs file system


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Copy files with pattern from ext4 to cifs file system
# 1  
Old 09-10-2013
Copy files with pattern from ext4 to cifs file system

Hi

I have a shell script to copy a pattern of files from Linux to Windows Filesystem.

When i execute the below command
Code:
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
Code:
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 ?
# 2  
Old 09-10-2013
Stupid question by me maybe but what happens with these from where you stand in the actual directory:
Code:
ls -la Windows/Folder && touch Windows/Folder/testbla

?
# 3  
Old 09-10-2013
Code:
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

Code:
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
Code:
TOUT_05-01-13-19\:01\:55.tar.gz
Does this delimiters causing the issue ?

# 4  
Old 09-10-2013
MS-Windows does not allow filenames with colons.
This User Gave Thanks to cero For This Post:
# 5  
Old 09-10-2013
Thank you cero

Could you please suggest any work around in this scenario ?
# 6  
Old 09-10-2013
Replace the colon with a allowed character, for example a dot:
Code:
#!/bin/bash
for i in TOUT_05-02-13*; do
   cp -av $i Windows/Folder/${i//:/.}
done

Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Copy pattern inside the file

Hi all, I have files and have a missing record. I need copy the existing record and mark those values up. For example in the below file 11048 is missing. I need to copy 22001 and copy those create the values for 11048. I have 120 set of files and I need to do that on all files. Note the... (8 Replies)
Discussion started by: arunkumar_mca
8 Replies

2. Shell Programming and Scripting

Copy data to new file based on input pattern

Hi All, I want to create a new file based on certain conditions and copy only those conditioned data to new file. Input Data is as it looks below. ORDER|Header|Add|32|32|1616 ORDER|Details1......... ORDER|Details2......... ORDER|Details3......... ORDER|Details4............ (10 Replies)
Discussion started by: grvk101
10 Replies

3. Shell Programming and Scripting

Copy/print all lines between pattern is found in .log files

Hi, I have a folder with multiple (< 33) .log files. And I have to copy the lines between two patterns from all the .log files to a new file. (script file with a loop?) Thanks in advance. 1.log ... .. xx1> begin ... .. .. >>> Total: 2 Alarms .. .. (17 Replies)
Discussion started by: AK47
17 Replies

4. Shell Programming and Scripting

Search the pattern and copy in to the file

my qn is i have one file hex.txt.it contains some junk data and some hexa valueslike hex.txt sdfjhjkh 0x1233jkfhgjfhgajk;gha 0xacdd jkgahfjkgha;sjghajklgha;gh aghfjkgh;a 0xccc jhfjkhsd ox23cd 0x456 jkhdfjhjkafh like this now iwant a script like to separate the hex values and paste into the... (12 Replies)
Discussion started by: siva.hardwork
12 Replies

5. AIX

Copy huge files system

Dear Guy’s By using dd command or any strong command, I’d like to copy huge data from file system to another file system Sours File system: /sfsapp File system has 250 GB of data Target File system: /tgtapp I’d like to copy all these files and directories from /sfsapp to /tgtapp as... (28 Replies)
Discussion started by: Mr.AIX
28 Replies

6. Shell Programming and Scripting

copy, then delete lines in file with sed using a pattern

I need to copy lines to a new file from files with sed using a pattern in char postions 1-3. Then after the copy, I need to delete those same lines from the input files. For example, string "ABC" in pos 1-3 (6 Replies)
Discussion started by: laksjfhoius9123
6 Replies

7. Shell Programming and Scripting

CIFS file system check.

I have written a script to take backup of linux data on window's shared folder. I have used following method in my script. mount -t cifs <windowshare> -o username=username,password=myPassword <mountlocation> However most of linux system doesnt support CIFS filesystem. How would i check if... (7 Replies)
Discussion started by: pinga123
7 Replies

8. Filesystems, Disks and Memory

ext4 - ready for production system?

Gidday, Are you using ext4 for production system? Or is it better to opt for a more conservative strategy, like ext3 for instance? What are your experiences? Thanks in advance, Loïc. (3 Replies)
Discussion started by: Loic Domaigne
3 Replies

9. UNIX for Dummies Questions & Answers

Copy a file from a dvd to the local AIX file system

Hi, I am a newbie to AIX, so please bear with me. I have mounted a dvd drive on AIX. I am trying to copy the file that is on the dvd drive on to the local machine. However, I get an error: cp: c1m_0001.gz: A system call received a parameter that is not valid. Can some one point me to the... (1 Reply)
Discussion started by: anurag1510
1 Replies
Login or Register to Ask a Question