0

I compressed a large number of small files (6102 pdf&txt files) on Ubuntu 16.04 using the default compression tool with right click and uploaded the zip file to net disk. However, after others download it and unzip it on Windows, they all get less files (5809). I tried to recompress and resend it, but it didn't work. Others still get less files. However, I uncompressed it on Ubuntu, it was right with 6102 files. Why they are different between Ubuntu and Windows? ps: I tried two different net disks. They are all 5809.

  • Do some of the files have the same name? Windows file systems aren't case sensitive so if you have FiLe and file, they will be considered one file. Do you have such cases? – terdon May 10 at 16:00
  • @terdon no, I have assigned different ids for all files. their names are in the format of xxx_id.pdf. id is from 1 to 6102. – xiaoyao Don May 10 at 16:05
  • Since you theoretically can find at least a few names that seems to go missing on Windows, can you see whether there's something special about these? Apart from that, this may be a better fit for the SuperUser site, possibly? – Kusalananda May 10 at 16:16
  • @Kusalananda Thanks, I checked it, it is because " * " can not be contained in windows file name. – xiaoyao Don May 11 at 3:42
2

According to a comment, this was due to the filenames containing the character *. This character, along with a few other characters (and substrings), are invalid in filenames on Windows systems.

On your Unix system, you may change all the * characters to e.g. _ (underscore) using the Perl rename utility like so:

rename -v 'tr/*/_/' ./*'*'*.pdf

This assumes that the PDF files are all located in the current directory. The expression tr/*/_/ is a Perl expression that changes all * to _ in a string (the filenames), and the filename globbing pattern ./*'*'*.pdf will match any file in the current directory with at least one * in its name and with a .pdf filename suffix.

A simple loop that does the same thing in bash:

for name in *'*'*.pdf; do
    mv -i "$name" "${name//'*'/_}"
done

... where "${name//'*'/_}" will be replaced by "$name" with all * characters changed into _ characters.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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