You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Moving files from one directory to another is extremely slow! #528
Use this script to generate files and folders for testing (the script will create "Files" directory which will contain "Dest" directory and 50 empty files. It will automatically open Caja):
#!/bin/bash
mkdir -p Files || exit 1
cd Files || exit 1
for ((i=1; $i <= 50; i++))
do
touch $i || exit 1
done
mkdir -p Dest || exit 1
exec caja --no-desktop .
Run the script.
Select all generated files (except the "Dest" directory).
Cut selected files (Ctrl+X), don't copy.
Open "Dest" directory.
Paste files (Ctrl+V) - this operation can take 10 sec. up to 40 sec.! Sometimes it pastes files immediately, so remove all files and test it again.
Tested with 1.12.6 (two computers) and master: ce7cc95
---
Want to back this issue? **[Post a bounty on it!](https://www.bountysource.com/issues/32336979-moving-files-from-one-directory-to-another-is-extremely-slow?utm_campaign=plugin&utm_content=tracker%2F651521&utm_medium=issues&utm_source=github)** We accept bounties via [Bountysource](https://www.bountysource.com/?utm_campaign=plugin&utm_content=tracker%2F651521&utm_medium=issues&utm_source=github).
What distro? What filesystem? Hard disk or SSD? What file manager are you comparing with and how quickly does it perform the same operation? Please provide actual metrics not an estimate.
Manjaro (Arch Linux), I've compiled Caja from sources (but Mate and GTK and GLib are from Manjaro repo). Tested on HDD and SSD.
CPU and HDD/SSD does nothing during this operation (notice that files generated by test script are empty). It doesn't depend on computer speed - I can compare it to random usleep() on every file.
The time differs, sometimes it is a few seconds (e.g. 10 sec), but sometimes it is 20, 30 or even 40 sec. It is hard to say, I can only create a movie (should I do it?)...
hmm, i follow your steps to reproduce, pasting the whole files takes about 0.5-1 sec here.
fedora 24 (alpha) with a hardware-raid with 4 ssd using raid0 mode.
Same with another hardware-raid with 4 normal disks in raid10 mode. No difference to previous test.
With a normal external disk connected via slow usb-2.0, not more than 8 or 12 secs.
Well, here i see random differences, but all tests are between those values.
I think those bad timings are because of usb-2.0, and with a slower disk you will see larger fluctuations.
Is your hardware not defect?
Btw. can you confirm your results with another file-manager, ie. nemo, nautilus or thunar?
Hmm, very strange...
All files are empty in my test, so HDD speed does nothing (it only creates 50 empty files (i-nodes?)). OS also caches files, so sometimes moving is done in RAM and later (on during unmounting) on real media. Please notice that it happens mostly, but not always - the time is also different on every attempt (sometimes also I've got about 1 sec).
And my new results for this test case:
Caja (gtk2) - almost always slow, sometimes very slow,
If you want to test again please don't cut-back files from "Dest" to "Files", but remove "Files" and create the directory again.
Please retest e.g. 5-10 times on the same machine.
@raveit65not more than 8 or 12 secs. - too long for 50 empty files :) Even on USB 1.1 (or floppy disk 😄) it should be instant. Of course it happens with many small (non-empty) files, e.g. while moving a lot of songs or photos. Please notice that copying (not moving) files from the test are instant, so why so slow on moving?
... it looks like random sleep, because CPU nor HDD does nothing, but moving 50 files can take up to 40 sec. (sometimes 10 sec, 5 sec or < 1 sec.).
Tested on Ubuntu 15.10 and Ubuntu's standard file browser - the same problem as in Caja... So it is not exactly a Caja bug, but is it possible to do a workaround in Caja? Moving files is a normal, frequently used operation, so it is not convenient to use another file manager like Thunar or write command line every time :) Moving hundreds or thousands files may take a few minutes or even hours!
i dont have to try your example, i run into this sometimes, i thought it happens more often when files are images & figured it's generating some thumbnail cache
i do not see any cpu usage during this time, no hard drive blinking, it just sits there for a few secs halting at random (some of the files moved, then pauses.... then eventually the rest finish), so it's not the hardware if different software works
it also takes a long time to open a folder with thousands of files, should i make a new issue about that? (i didnt search yet, although maybe the problem is it's scanning the amount of files in subfolders to display in the list view column)
Use Ctrl+X and Ctrl+V for moving :) I've killed Caja after 7 minutes, it moves 698 files in 7 minutes. E.g. Thunar can do it in ~1 second, Dolphin (KDE 5) in ~5 seconds.
I've had the problem myself, and it looks like a very old Nauilus bug that nobody has ever fixed. I see this more on moving files than copying them, my video copy jobs normally go OK, but the really ugly case is cleaning two overlapping directories of Debian files. I do this by moving files from one directory into the other, overwriting any copies found there, then moving back. This is very likely to hang outright and force me to kill Caja. No files will be missing or corrupted, all will be in one directory or the other. Still, if I am cleaning directories it pays to back up both of them first.
Copying or moving a whole directory always goes cleanly, it's with a large number of individual files I sometimes get trouble. Copying a newer version of a file onto an older version with the same name in a flash drive (even ONE file) is so nasty I usually delete the older version first, though I've always blamed the flash drives themselves for that.
Also sometimes (very rare) I've noticed that after successful copying files the windows used to show progress can't close (only killing Caja can close it).
Totally new here. I came across a very similar problem (not to say exactly the same) yesterday while copying 5G of data from one HD to another.
Since I'm not a developper at all, I won't be looking in the code. But maybe with your help, I can set a cron job to log the problem when it occurs (I can try to reproduce it).
well i was just copying (sometimes moving) over 500GB across different drives twice without a problem
yet moving a set of 350 jpgs from one folder to another on the same drive resulted in getting stuck... couldnt browse new folders in other caja windows, couldnt open a new caja window, the stop button still took a couple minutes for anything to happen & eventually the multiple new caja windows opened up after the progress window closed
i resumed the move now, let's time it:
after 2m10s: 130 items remaining
2m11s: 103 items
4m20s: 102
4m30s: 45
5m00s: 44
5m25s: 43
5m40s: 24
5m41s: done
(to add to this annoyance, i was on an external this time, stupid WD sets it to park after only 6secs of no activity, i was playing loosely encoded videos earlier, but this time i had an mp3 playing, which buffered like 10secs at a time, so the drive kept parking & unparking, i wouldnt have been able to traverse in caja back to the videos folder to stop it from parking)
so maybe one thing more important than this bug is to have file operations in a new process like windows has for explorer (good way to not worry about the desktop/tray going down if one of the explorer windows crashes, if you remember to enable it, off by default)
Trying to help narrowing down the issue... I just transferred over 4.5GB of data (a mix of folders, photos and videos) at a steady 20MB/s from a PPTP device. This is Nemo on Debian, package version 3.2.2-3, likely more recent than the one I was using in December for my previous message.
@actinism aren't you doing two very different things in each case? By moving the "pics" folder, there is just one filesystem entry which has to be changed, whereas in the second case, it has to be done for each file in the folder, so case 1 is by nature faster than case 2.
@sleveque Right, but physically these are two different hardware devices. /home (SSD with ext4) to a harddrive .../_test ... like @kn00tcn saying this is likely metadata or something.
@zaps166 yes, I am aware that even with empty files the problem can show up. My point was to highlight that PPTP, unlike regular filesystems (be it on an external device or not), didn't seem to be affected. I have no idea how PPTP works, though I guess that at some point g_file_move() is also involved.
Here's the synposis of the Nautilus change that went with the GVFS change:
"When copying, moving or linking files, original sources and their destinations
are stored in an information structure used for undoing the operation. The
sources and destinations were appended at the end of a list. Due to append
taking linear time, there was a noticeable decrease in speed when operating with
many files. In order to fix this, the sources and destinations are stored in a
queue that allows appending in constant time."
Unfortunately the changes to Nautilus for this won't apply directly to Caja unless we update the entire undo/redo structure to match what Nautilus does. I did a quick mate-search-tool search of a Caja source directory for one of the variables in https://bugzilla.gnome.org/attachment.cgi?id=327593&action=diff
and it was not present at all. I recall "create an undo manager" as one of the nautilus changes not brought into Caja with the GtkApplication work.
We could copy the entire "create an undo manager" setup, but when I first did the GtkApplication port we needed to be able to build the same code with GTK3 or GK2, and with or without libunique in GTK3. The port alone was complex enough at the time. We can go back to this item though, and iterate through the relevant commits
We'll have to try it and see. I've had only minimal problems with this myself so difficult to reliably test. I'll see if Debian has built gvfs with the fix and install it now if they have. I normally hold updates until I have access to on-road wifi(no landline at home).
My last gvfs update (to 1.30.1-b1) was on June 25, this is later than the version shown in the bug report. We can redo the under manager if this problem persists with known good gvfs versions. I did not add all that to last year's GtkApplication work in order to limit the extent of an already radical change at the limits of my skill to those things needed for that particular change. Nautilus as a whole got a hell of a lot of changes between 2.32 and 3.0
Activity
flexiondotorg commentedon Mar 28, 2016
What distro? What filesystem? Hard disk or SSD? What file manager are you comparing with and how quickly does it perform the same operation? Please provide actual metrics not an estimate.
zaps166 commentedon Mar 28, 2016
Manjaro (Arch Linux), I've compiled Caja from sources (but Mate and GTK and GLib are from Manjaro repo). Tested on HDD and SSD.
CPU and HDD/SSD does nothing during this operation (notice that files generated by test script are empty). It doesn't depend on computer speed - I can compare it to random
usleep()on every file.The time differs, sometimes it is a few seconds (e.g. 10 sec), but sometimes it is 20, 30 or even 40 sec. It is hard to say, I can only create a movie (should I do it?)...
raveit65 commentedon Mar 29, 2016
hmm, i follow your steps to reproduce, pasting the whole files takes about 0.5-1 sec here.
fedora 24 (alpha) with a hardware-raid with 4 ssd using raid0 mode.
Same with another hardware-raid with 4 normal disks in raid10 mode. No difference to previous test.
With a normal external disk connected via slow usb-2.0, not more than 8 or 12 secs.
Well, here i see random differences, but all tests are between those values.
I think those bad timings are because of usb-2.0, and with a slower disk you will see larger fluctuations.
Is your hardware not defect?
Btw. can you confirm your results with another file-manager, ie. nemo, nautilus or thunar?
zaps166 commentedon Mar 29, 2016
Hmm, very strange...
All files are empty in my test, so HDD speed does nothing (it only creates 50 empty files (i-nodes?)). OS also caches files, so sometimes moving is done in RAM and later (on during unmounting) on real media. Please notice that it happens mostly, but not always - the time is also different on every attempt (sometimes also I've got about 1 sec).
And my new results for this test case:
If you want to test again please don't cut-back files from "Dest" to "Files", but remove "Files" and create the directory again.
Please retest e.g. 5-10 times on the same machine.
@raveit65
not more than 8 or 12 secs.- too long for 50 empty files :) Even on USB 1.1 (or floppy disk 😄) it should be instant. Of course it happens with many small (non-empty) files, e.g. while moving a lot of songs or photos. Please notice that copying (not moving) files from the test are instant, so why so slow on moving?... it looks like random sleep, because CPU nor HDD does nothing, but moving 50 files can take up to 40 sec. (sometimes 10 sec, 5 sec or < 1 sec.).
zaps166 commentedon Apr 13, 2016
Tested on Ubuntu 15.10 and Ubuntu's standard file browser - the same problem as in Caja... So it is not exactly a Caja bug, but is it possible to do a workaround in Caja? Moving files is a normal, frequently used operation, so it is not convenient to use another file manager like Thunar or write command line every time :) Moving hundreds or thousands files may take a few minutes or even hours!
kn00tcn commentedon Aug 15, 2016
i dont have to try your example, i run into this sometimes, i thought it happens more often when files are images & figured it's generating some thumbnail cache
i do not see any cpu usage during this time, no hard drive blinking, it just sits there for a few secs halting at random (some of the files moved, then pauses.... then eventually the rest finish), so it's not the hardware if different software works
it also takes a long time to open a folder with thousands of files, should i make a new issue about that? (i didnt search yet, although maybe the problem is it's scanning the amount of files in subfolders to display in the list view column)
zaps166 commentedon Oct 16, 2016
Unfortunately developers doesn't care about old annoying bugs (and also regressions) :(
Still happens on 1.16.0. Moving files by drag and drop works OK, but Cut->Paste is broken.
Now I've killed Caja on moving a lot of photos (after a few minutes, but it should take milliseconds).
raveit65 commentedon Oct 16, 2016
I answered but i couldn't reproduce it, please stop to tell lies here 😒
zaps166 commentedon Oct 16, 2016
@raveit65 I also thought about my PRs which are w/o any response for months 😢 (not for Caja, but for panel/applets).
My configuration:
Sometimes it can take one second, sometimes 30 sec, etc. Sometimes moving hundreds of photos can lock Caja.
Please try this (1000 files):
Use Ctrl+X and Ctrl+V for moving :) I've killed Caja after 7 minutes, it moves 698 files in 7 minutes. E.g. Thunar can do it in ~1 second, Dolphin (KDE 5) in ~5 seconds.
lukefromdc commentedon Oct 16, 2016
I've had the problem myself, and it looks like a very old Nauilus bug that nobody has ever fixed. I see this more on moving files than copying them, my video copy jobs normally go OK, but the really ugly case is cleaning two overlapping directories of Debian files. I do this by moving files from one directory into the other, overwriting any copies found there, then moving back. This is very likely to hang outright and force me to kill Caja. No files will be missing or corrupted, all will be in one directory or the other. Still, if I am cleaning directories it pays to back up both of them first.
Copying or moving a whole directory always goes cleanly, it's with a large number of individual files I sometimes get trouble. Copying a newer version of a file onto an older version with the same name in a flash drive (even ONE file) is so nasty I usually delete the older version first, though I've always blamed the flash drives themselves for that.
zaps166 commentedon Oct 16, 2016
Also sometimes (very rare) I've noticed that after successful copying files the windows used to show progress can't close (only killing Caja can close it).
filosophem commentedon Oct 17, 2016
Hello everyone,
Totally new here. I came across a very similar problem (not to say exactly the same) yesterday while copying 5G of data from one HD to another.
Since I'm not a developper at all, I won't be looking in the code. But maybe with your help, I can set a cron job to log the problem when it occurs (I can try to reproduce it).
Let me know if It's doable
kn00tcn commentedon Oct 18, 2016
well i was just copying (sometimes moving) over 500GB across different drives twice without a problem
yet moving a set of 350 jpgs from one folder to another on the same drive resulted in getting stuck... couldnt browse new folders in other caja windows, couldnt open a new caja window, the stop button still took a couple minutes for anything to happen & eventually the multiple new caja windows opened up after the progress window closed
i resumed the move now, let's time it:

after 2m10s: 130 items remaining
2m11s: 103 items
4m20s: 102
4m30s: 45
5m00s: 44
5m25s: 43
5m40s: 24
5m41s: done
(to add to this annoyance, i was on an external this time, stupid WD sets it to park after only 6secs of no activity, i was playing loosely encoded videos earlier, but this time i had an mp3 playing, which buffered like 10secs at a time, so the drive kept parking & unparking, i wouldnt have been able to traverse in caja back to the videos folder to stop it from parking)
so maybe one thing more important than this bug is to have file operations in a new process like windows has for explorer (good way to not worry about the desktop/tray going down if one of the explorer windows crashes, if you remember to enable it, off by default)
zaps166 commentedon Oct 18, 2016
@kn00tcn Exactly this bug :)
sudo hdparm -B 255 /dev/sdX(Xis the letter of hard drive; Docs)24 remaining items
actinism commentedon Mar 26, 2017
@lukefromdc did some different tests with nautilus. (symlink folder to real folder etc. or native mount to native mount).
setup: 2 nautilus windows, dragging folder/files with shift-hold-click (move) from one to the other
System:
Release Linux Mint 18 Sarah 64-bit
Kernel Linux 4.8.0-39-generic x86_64
MATE 1.14.1
kn00tcn commentedon Mar 27, 2017
i dont think it's a caja/nautilus bug directly, it's gvfs-metadata most likely
a file manager that doesnt use that is fine
protopyte commentedon Mar 27, 2017
Trying to help narrowing down the issue... I just transferred over 4.5GB of data (a mix of folders, photos and videos) at a steady 20MB/s from a PPTP device. This is Nemo on Debian, package version 3.2.2-3, likely more recent than the one I was using in December for my previous message.
@actinism aren't you doing two very different things in each case? By moving the "pics" folder, there is just one filesystem entry which has to be changed, whereas in the second case, it has to be done for each file in the folder, so case 1 is by nature faster than case 2.
actinism commentedon Mar 27, 2017
@sleveque Right, but physically these are two different hardware devices. /home (SSD with ext4) to a harddrive .../_test ... like @kn00tcn saying this is likely metadata or something.
I will test with some other data ...
zaps166 commentedon Mar 27, 2017
@sleveque @actinism It is not HDD/SSD or file size issue. You can move empty (0 bytes) files to activate a bug.
Gio waits for dbus (see #528 (comment)). The function
g_file_move()behaves weird in Caja, Nemo and similar file browsers. I wrote my tests for this function a few months ago and it worked very fast on stand-alone application. Also Thunar probably calls it (https://github.com/xfce-mirror/thunar/blob/thunar-1.6.10/thunar/thunar-transfer-job.c#L984) an it doesn't have any problems.protopyte commentedon Mar 27, 2017
@zaps166 yes, I am aware that even with empty files the problem can show up. My point was to highlight that PPTP, unlike regular filesystems (be it on an external device or not), didn't seem to be affected. I have no idea how PPTP works, though I guess that at some point
g_file_move()is also involved.jeremy447 commentedon May 9, 2017
I just stumbled across this issue by reading an unrelated reddit thread and it reminded me this gvfs issue (fixed) that can be the real problem here.
https://bugzilla.gnome.org/show_bug.cgi?id=757747
lukefromdc commentedon May 10, 2017
Here's the synposis of the Nautilus change that went with the GVFS change:
"When copying, moving or linking files, original sources and their destinations
are stored in an information structure used for undoing the operation. The
sources and destinations were appended at the end of a list. Due to append
taking linear time, there was a noticeable decrease in speed when operating with
many files. In order to fix this, the sources and destinations are stored in a
queue that allows appending in constant time."
Unfortunately the changes to Nautilus for this won't apply directly to Caja unless we update the entire undo/redo structure to match what Nautilus does. I did a quick mate-search-tool search of a Caja source directory for one of the variables in
https://bugzilla.gnome.org/attachment.cgi?id=327593&action=diff
and it was not present at all. I recall "create an undo manager" as one of the nautilus changes not brought into Caja with the GtkApplication work.
lukefromdc commentedon Jun 8, 2017
We could copy the entire "create an undo manager" setup, but when I first did the GtkApplication port we needed to be able to build the same code with GTK3 or GK2, and with or without libunique in GTK3. The port alone was complex enough at the time. We can go back to this item though, and iterate through the relevant commits
monsta commentedon Aug 22, 2017
@lukefromdc: do you think we need to make any changes in Caja? I thought the fix in gvfs should be enough.
lukefromdc commentedon Aug 22, 2017
We'll have to try it and see. I've had only minimal problems with this myself so difficult to reliably test. I'll see if Debian has built gvfs with the fix and install it now if they have. I normally hold updates until I have access to on-road wifi(no landline at home).
lukefromdc commentedon Aug 22, 2017
My last gvfs update (to 1.30.1-b1) was on June 25, this is later than the version shown in the bug report. We can redo the under manager if this problem persists with known good gvfs versions. I did not add all that to last year's GtkApplication work in order to limit the extent of an already radical change at the limits of my skill to those things needed for that particular change. Nautilus as a whole got a hell of a lot of changes between 2.32 and 3.0
vkareh commentedon Jun 26, 2026
Fixed by #1896