Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

so I`m trying to do the following:

When rtorrent finishes download, it should copy files from download dir to another dir called uploads, so the file would be in Downloads dir AND in Uploads dir.

Before this I was using mv function to move file from Downloads to Uploads an here is a working example so you could understand rtorrents syntax:

system.method.set_key = event.download.finished,move_complete,"execute=mv,-u,$d.get_base_path=,~/uploads/"

This is working preview it executes "mv -u /home/downloads/folder1/ ~/uploads/, so basically it moves the torrent with the same name just to another dir.

The thing I do NOT get it how can I copy files (folders and files, depending on what Im downloading) with the same name, lets say:

/home/dl/harry potter/ ------> /home/ul/harry potter/

and next one could be

/home/dl/ubuntu.iso ------> /home/ul/ubuntu.iso
share|improve this question

migrated from stackoverflow.com May 1 '11 at 13:26

This question came from our site for professional and enthusiast programmers.

2  
You should try posting this on SuperUser.com, SO's sister site. –  indyK1ng Jan 14 '11 at 5:37
    
Also, use softlinks for goodness sakes. –  TomMD Jan 14 '11 at 5:56
    
what`s softlinks? –  Treat Jan 16 '11 at 19:46
    
@Treat - a 'softlink' is a symlink. –  boehj May 1 '11 at 13:35

1 Answer 1

You'd probably want to use cp -a, which will recursively copy and preserve file and folder permissions. That is, if you actually want to copy all files. Hint: there's no need for that.

cp -al is ultimately what you want to use. The concept of links on unix systems is far more complex (and useful) than on Windows. TomMD suggests you use "softlinks", by which I assume he means symlinks, or symbolic links. cp -l creates hardlinks, however.

Files on a unix filesystem consist, on a very high level, of the data on disk, and one or more hardlinks that point at that data. You access data by pointing your programs at these links. When a bunch of data has zero hardlinks pointing at it, it is considered as deleted.

If you understand this, you probably are already thinking about how cool this is. You can have multiple references to a single "data group", without the overhead of actually having multiple copies of it lying around. You can treat these hardlinks as regular files in all cases, which includes moving, copying, reading, and writing.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.