-1

Want to Gzip my all the .csv files into a gzip file.

I am using this command.

gzip *.csv;

Problem File contains '//' in its name that's why command is giving error.

Error : - '//File.csv' is not a directory or file.

So please suggest me what ways i can do this successfully.

one solution i thought.

gzip '//File1.csv' '//File2.csv' '//File3.csv'

Please suggest me if this is the right way to perform the same.

closed as unclear what you're asking by Gilles, Braiam, jasonwryan, Hauke Laging, slm Dec 18 '14 at 3:20

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • 2
    / is not a valid character in a filename in any *nix filesystem I have used. In fact, it's not even valid in Windows filesystems such as NTFS. – jordanm Dec 17 '14 at 5:48
  • Its coming because we have some old legacy code. Best solution is change that but it can create a mess for us. – Java_Alert Dec 17 '14 at 6:19
  • Agree with @jordanm - it's not possible to create a file with a '/' (or \0) in the name, with any standard, user-level programs. It doesn't matter how legacy your code is. Can you post a screen shot, or more details about where the files are coming from? Is it a samba mount for example? stackoverflow.com/questions/1976007/… – Ian McGowan Dec 17 '14 at 7:27
  • Next time, please do not cross post your question to multiple sites. – slhck Dec 17 '14 at 8:13
  • It's impossible to have the character / in a file name. What is the actual file name? What is the exact error message? Always copy-paste error messages. – Gilles Dec 17 '14 at 22:10
1

There are only two characters that are really not allowed in a filename in unix, and you've got one of them.

https://stackoverflow.com/questions/457994/what-characters-should-be-restricted-from-a-unix-file-name

Are the files on a usb stick formatted as some exotic file system? You really have to try hard to get a "/" into a filename in unix.

http://www.unix.com/tips-and-tutorials/198879-how-manage-file-names-special-characters.html has some suggestions, the easiest of which is to go back to what ever system produced the files in the first place.

1

Use a loop! for F in *.csv; do gzip "$F"; done will work because of the quotes around $F

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