As was foretold, we've added advertisements to the forums! If you have questions, or if you encounter any bugs, please visit this thread: https://forums.penny-arcade.com/discussion/240191/forum-advertisement-faq-and-reports-thread/

Moving files in Linux?

electricitylikesmeelectricitylikesme Registered User regular
Is there an easy way to move a large number of files around in Linux when you expect the move to be interrupted? The 'mv' command is proving itself pretty damn worthless at the moment.

My problem is I'm running glusterfs on a single machine to cluster all it's disks together as one big drive. This is not seamless, but my problem is the cluster is very very full as it is - so I can't copy files around and then delete them (unless I use a network computer as a temp drive). But, gluster will also periodically throw an error if it starts trying to move say, a DVD image to a drive with only 2gb of free space left.

What I need, is something that will work like the 'mv' command and just rename the files, but which will let me merge large directory trees with it (i.e. Movies has an identical file structure to glusters "Movies" - lots of individual folders but not all containing files. I want the command to fill the directories in the destination that are empty with files from the source that are in directories with the same name).

Is there a command in linux to do this? I refuse to believe there isn't but damned if I can find it. I'm running Debian 'etch' incidentally.

electricitylikesme on

Posts

  • DeathPrawnDeathPrawn Registered User regular
    edited June 2008
    Sounds like this could be accomplished fairly simply using a clever shell script.

    DeathPrawn on
    Signature not found.
  • Zilla360Zilla360 21st Century. |She/Her| Trans* Woman In Aviators Firing A Bazooka. ⚛️Registered User regular
    edited June 2008
    I'd ask the developers in this instance:
    http://www.gluster.org/mailing-list.php

    Zilla360 on
    |Ko-Fi Me! ☕😎|NH844lc.png | PSN | chi-logo-only-favicon.png(C.H.I) Ltd. |🏳️⚧️♥️
  • bashbash Registered User regular
    edited June 2008
    rsync?
    % rsync -a source/directory/ destination/directory/
    

    You could also use this little bash script:
    for x in sourcedir/*
    do
       mv $x destdir/
    done
    

    I think that will move directories as well as files.

    bash on
    comi-sig1.jpg
  • seasleepyseasleepy Registered User regular
    edited June 2008
    It's somewhat counterintuitive, but would rsync (or something else along those lines) be more what you're looking for? Since it's designed for copying over networks, it's built to deal with stopping/restarting, but it'll work for copying on local filesystems as well.

    Edit: beat'd. That's what I get for looking at manpages before posting. ;-)

    seasleepy on
    Steam | Nintendo: seasleepy | PSN: seasleepy1
  • electricitylikesmeelectricitylikesme Registered User regular
    edited June 2008
    Well in the end I just deleted what I copied and restarted the job from my local network, but next time I might try rsync. I've also sub'd to the developers list since it seems someone finally reported the issue I keep having with gluster (double creating my files and thus denying access to them until I go in and manually delete one copy).

    electricitylikesme on
Sign In or Register to comment.