Moving files


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Moving files
# 1  
Old 03-02-2010
Moving files

Hi

I need to be able to move files from one central locations to different servers on our network. So i want all of our operators to place files to one area on the main storage area. From there i need a script that first checks the file is stable (finished copying)
then copy to another server, on completion of copy the file needs to be deleted from the original location.
thanks

Treds

Last edited by Franklin52; 03-02-2010 at 04:50 AM.. Reason: Removing code tags regular text
# 2  
Old 03-02-2010
You can do in with the scp itself .
# 3  
Old 03-02-2010
rsync
# 4  
Old 03-02-2010
Script

Sorry very new to this have you got a script that i can see as a example

---------- Post updated at 09:19 AM ---------- Previous update was at 09:12 AM ----------

hi i have this working but how do i delete the file once its copied?
Code:
rsync -aWv --stats --progress --delete \
/prod/TAG_MASTER_WORKFLOWS/PRESS_235 5.0.2.235:/symlnks/io/jobs/workflows/TAG-466/Twist_Master/

treds

Last edited by vbe; 03-02-2010 at 06:12 AM.. Reason: ajusted code tags...
# 5  
Old 03-02-2010
Try this
Code:
scp -r directoryname username@ipaddress:<path if needed> # if you Xfer a file only then remove -r option 
# it will ask a password
rm -rf directoryname


# for ex:
#         scp Filename abubacker@192.168.1.12:~
#         rm -rf Filename

# 6  
Old 03-02-2010
First, you need to define exactly what you mean by "finished copying", and you need to define it precisely.

And remember you're going to have to handle error conditions, too, such as when someone is copying a file remotely and the connection drops before the copy is done.

FWIW, the only person who can tell definitively that any copy is complete is the person sending the file, because the receiver can't know what's being sent as the receiver doesn't have the original. That means if you value reliability and guaranteed correctness, you MUST have the sender somehow flag that the copy is complete. Probably the easiest way is with a rename of the file. Call it something like 'filename.part' while copying, then rename it to 'filename' once the copy is done.

No, you CAN'T reliably use something like lsof on a Linux box to check if any other process has the file open, because that ignores error conditions.
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. AIX

Moving Hidden files to normal files

I have a bunch of hidden files in a directory in AIX. I would like to move these hidden files as regular files to another directory. Say i have the following files in directory /x .test~1234~567 .report~5678~123 .find~9876~576 i would like to move them to directory /y as test~1234~567... (10 Replies)
Discussion started by: umesh.narain
10 Replies

2. UNIX for Dummies Questions & Answers

Moving Files to VM

Hi guys, i need to test a script on my RedHat which it's mounted on a VirtualBox (oracle VM). So i need to copy a directory with subdirectories, from a remote host to my VM. I'd like to do that within cmd not with program like Filezilla or something like that. Any idea please? (4 Replies)
Discussion started by: Newer
4 Replies

3. UNIX for Dummies Questions & Answers

Moving files..

Selected directories on our system generate alerts when they exceed 60% of the disk space so I have used gzip to make the files smaller on one of the directories in question (AdminServer logs). I want to move these to another directory what is the best way to make this happen? Thanks.. (4 Replies)
Discussion started by: nosuchluck
4 Replies

4. Shell Programming and Scripting

Finding files with wc -l results = 1 then moving the files to another folder

Hi guys can you please help me with a script to find files with one row/1 line of content then move the file to another directory my script below runs but nothing happens to the files....Alternatively Ca I get a script to find the *.csv files with "wc -1" results = 1 then create a list of those... (5 Replies)
Discussion started by: Dj Moi
5 Replies

5. UNIX for Dummies Questions & Answers

Moving Multiple files to destination files

I am running a code like this foreach list ($tmp) mv *_${list}.txt ${chart}_${list}.txt #mv: when moving multiple files, last argument must be a directory mv *_${list}.doc ${chart}_${list}.doc #mv: when moving multiple files, last argument must be a... (3 Replies)
Discussion started by: animesharma
3 Replies

6. Shell Programming and Scripting

moving the files in a.txt files to a different directory

HI All, I am coding a shell script which will pick all the .csv files in a particular directoryand write it in to a .txt file, this .txt file i will use as a source in datastage for processing. now after the processing is done I have to move and archive all the files in the .txt file to a... (5 Replies)
Discussion started by: subhasri_2020
5 Replies

7. Shell Programming and Scripting

Moving files

I wrote a script which moves files on first in first out basis. for i in `ls -ltr | grep ^- | head -10 | awk '{print $9}'` do mv $i Test/ done But donno some reason, this is not working on my Linux box. May i know the reason? Can the above script be done by using positional... (2 Replies)
Discussion started by: venkatesht
2 Replies

8. Shell Programming and Scripting

Moving Files

Hi There, I am trying to move files, the file is present in this location: /iAm4Free/test/generate/txt/information.txt I need to move it to: /iAm4Free/test1/generate/txt/information.txt The only difference is the "test" is replaced with "test1". But the constraint is. The parent... (5 Replies)
Discussion started by: iAm4Free
5 Replies

9. UNIX for Dummies Questions & Answers

moving files ??

I am using AIX Version 5.1 If I moved a file say using this command but the directory rpt did not exist would this dump the file? I went back to the directory I was moving it from and the file was gone and when I looked in the directory I moved it to of course that directory was not found.... (9 Replies)
Discussion started by: rocker40
9 Replies

10. UNIX for Dummies Questions & Answers

moving only files...

hi.. I want to move a set of files that contain a particular string. I wished to do that with find but i am unable to do that. can anybody give me a good method? :) (12 Replies)
Discussion started by: sskb
12 Replies
Login or Register to Ask a Question