Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie
Hi there,
There is an issue with role permissions that is being worked on at the moment.
If you are having trouble with access or permissions on regional forums please post here to get access: https://www.boards.ie/discussion/2058365403/you-do-not-have-permission-for-that#latest

quick 'cp' and 'rmdir' question

  • 12-04-2004 4:30pm
    #1
    Registered Users, Registered Users 2 Posts: 8,488 ✭✭✭


    trying to copy some files over to my USB harddrive...

    I did cp *dir* *USBdir*, but I thought it failed, so I did an rmdir on my USB disk, which didn't report any problems.

    But, apparently the files are still copying over.

    So my question is, is rmdir just waiting until all the files are there before deleting them? or has it been forgottin about?

    Seen as the cp worked, I'd prefer the files weren't deleted again.


Comments

  • Moderators, Arts Moderators Posts: 35,738 Mod ✭✭✭✭pickarooney


    What made you think it had failed?
    Did you Ctrl-c or Ctrl-z the operation?
    Did you type rmdir from the same terminal window? Normally even if it does try to rmdir after copying the files it will tell you that the directory is not empty (unless you have an alias rm -rf for rmdir).


  • Registered Users, Registered Users 2 Posts: 8,488 ✭✭✭Goodshape


    Just my inexperience with linux shining through really :rolleyes:

    I closed the terminal window, thinking that would cancel the 'cp' (the prompt hadn't returned since I entered the command). Then in a new window I ordered the rmdir, ignoring non-empty.

    Either linux has queued that command, or it's been overridden by the ongoing cp?


  • Moderators, Arts Moderators Posts: 35,738 Mod ✭✭✭✭pickarooney


    so which was it in the end?


  • Registered Users, Registered Users 2 Posts: 188 ✭✭slartibardfast


    linux uses an extensive disk cache and buffers system, that means stuff doesn't happen instantly on disk.
    Even if the command appears finished, the filesystem may not yet reflect the command!

    The command: sync
    Flushes these buffers, altough you may want to run it twice, as a guarantee!

    Hope this will help avoid confusion in the future.


  • Registered Users, Registered Users 2 Posts: 8,488 ✭✭✭Goodshape


    After about an hour copying.... they didn't get deleted :)

    Was touch and go for a while though - it told me the device was busy when I tried to umount... but I was sitting in the directory :dunno:

    Learn something new everyday.


  • Advertisement
Advertisement