RAR/WINRAR M or A -DF fail with $S

Discussion & Support for xplorer² professional

Moderators: fgagnon, nikos, Site Mods

Post Reply
Caveatrob
Member
Member
Posts: 40
Joined: 2008 Aug 01, 18:07

RAR/WINRAR M or A -DF fail with $S

Post by Caveatrob »

If I try to pass $S into winrar with "a -df" (add and delete files) or "m" (archive and delete files), depending on the order that X2 sends the files in as parameters, the archiving fails with "Directory is Not Empty" sometimes.

In other words, WinRAR receives the list from xPlorer2 and progressively goes through adding and removing files, but if the list is out of order with subfolders, it messes up.

I'm using

Code: Select all

$ RAR A -DF -R $P\$C.RAR $S
Kilmatead
Platinum Member
Platinum Member
Posts: 4596
Joined: 2008 Sep 30, 06:52
Location: Dublin

Re: RAR/WINRAR M or A -DF fail with $S

Post by Kilmatead »

Caveatrob wrote:...but if the list is out of order with subfolders, it messes up.
x2 sends the $S list (names without paths) in the order which it is displayed in the pane.  Do you have Tools -> Options -> Window (Tab) - Folders Sorted set to "As Files" or "Separately"?

Setting it to "Separately" will always force the folders to the "top" of the pane, thus they will always be included in the list before any other selected contents within the pane.

If that doesn't work, can you provide an example (folder structure, contents, method of selection) which will reliably recreate this?  Exactly how can the list be "out of order" with subfolders?

I have tried your command (using '>' rather than '$') on numerous different structures of differing sizes (from 5 MB to 10 GB) with different combinations of selections (folders/files), and different sort orders - but I cannot recreate this as mine works every time.
Kilmatead
Platinum Member
Platinum Member
Posts: 4596
Joined: 2008 Sep 30, 06:52
Location: Dublin

Post by Kilmatead »

...and (just as an addendum), now that I look at it, you might want to add quotations around the '$P\$C.RAR' parameter, else you'll be rather unhappy with filenames/paths which happen to include spaces...

A -DF -R "$P\$C.RAR" $S

And, while I'm at it, you might want to be very very careful of what your drive-labels happen to be if you're archiving things from root-folders, as the name of the archive for a root will be the drive label - and drive labels can contain "illegal" characters, such as ":", etc... so if you submit your command, WinRAR will happily process it, and delete all the objects, but create a dead 0-Byte file of a partial name.

For example, if my E: drive happened to be named "Alarums And Excursions ( E: )" - with the "E:" added as part of the name - if I selected a folder in the root of that drive, say "Test Folder", WinRAR will try to create a file called "E:\Alarums And Excursions ( E: ).RAR" and fail as described above.  But since it doesn't know it failed, everything from "Test Folder" is completely unrecoverable, as far as I can tell. :shock:

Interestingly, if I intentionally try and create a RAR with an illegal file-name (by replacing the '$P\$C.RAR' with a static name that is intentionally wrong, like "C:\COLON_C:.RAR" WinRAR properly reports the error and doesn't attempt to create a corrupted archive.

As x2 is just passing the drive label as it's supposed to, it's not an x2 bug - so I suspect WinRAR needs slightly better error checking when it actually tries to create the file handle, rather than just checking for "potential" errors beforehand.  It would be interesting to submit this to them as a bug and see if they reply with a rude word or not, considering they probably don't go out of their way to support anything other than WinExplorer, and just assume their error-checking is sufficient, when it's... not.

But the caveat remains the same - be very careful what your drive labels are before you submit this command on root contents.
Post Reply