Reputation
4,177
Top tag
Next privilege 5,000 Rep.
Approve tag wiki edits
Badges
13 35
Impact
~775k people reached

Mar
12
awarded  Critic
Mar
12
comment Deleting all files in a folder except files X, Y, and Z
a) You move your file X one directory up, where a file X exists - silently deleted, gone. b) You're in the top dir, where no 'up' exists. c) You're in your home, and don't have permission to write to /home. If you put your advice into a script, and tested it without problem, and use it in such a situation - peng!
Mar
12
comment Deleting all files in a folder except files X, Y, and Z
If you have three files a, b and a b the first program will delete - if you put ab into the grep part: "^[ab]$" a and b but not a b, just opposed to your intentions. The second command will do the same. And the third too. You shouldn't use 'ls' in scripts, with very, very rare exceptions. Just don't do it.
Mar
12
comment Deleting all files in a folder except files X, Y, and Z
Since folders under Unix are files (anything is a file), that's maybe what is intended. The question explicitly says: "I have a lot of files and folders in a specific folder and I want to delete all of them; " - and if you like to exclude Y, maybe you know whether Y is a directory or not.
Mar
11
comment Compare files that are in directory 1 but not directory 2?
Yes, it isn't d2/f but d2/f . Tabs and newlines in filenames are rare, but allowed.
Mar
11
revised Compare files that are in directory 1 but not directory 2?
working in all aspects now
Mar
11
comment Compare files that are in directory 1 but not directory 2?
So effectively you don't have any concrete example?
Mar
11
comment Compare files that are in directory 1 but not directory 2?
@geekosaur: you might have noticed that I use test together with find. Which program would you expect to fail when invoked with 'find' and why?
Mar
11
revised Compare files that are in directory 1 but not directory 2?
now calling test without bash
Mar
11
comment Compare files that are in directory 1 but not directory 2?
You should test your program with a file called "d2/f ". Rule of thumb: Nearly never use ls in scripts.
Mar
11
awarded  Editor
Mar
11
revised Compare files that are in directory 1 but not directory 2?
explaining the find command
Mar
11
comment Compare files that are in directory 1 but not directory 2?
Not with find, do I?
Mar
11
comment Compare files that are in directory 1 but not directory 2?
ls will come with all problems with white space, tabs, linefeeds, backspaces and such in filenames.
Mar
11
comment Please recommend a GUI telnet client
Usage of telnet is strongly discouraged. Having said that, of course, there are some appliances out there which just speak telnet, and not ssh. Then use two xterms, one with telnet, one with man-telnet. Or xterm:telnet + firefox:telnet-help
Mar
11
answered Compare files that are in directory 1 but not directory 2?
Mar
11
answered Compare files that are in directory 1 but not directory 2?
Mar
8
comment Why do /usr and /tmp directories for Linux miss vowels in their spellings?
I heared /usr stands for unix system ressources, not user. But I too heard that it is another myth. :) I don't have evidence.
Mar
7
comment Why do /usr and /tmp directories for Linux miss vowels in their spellings?
I have never written or inspected a filesystem in depth, but does the name of a file/directory in the filesystem occupy more or less space, depending on 1 character? The files themselves always occupy a multiple of some size - today 4k. So most files which contain a path to /usr or /tmp will not effectively get smaller or bigger, depending on a single e. Well - sometimes they will, and then they grow for a whole blocksize, but rarely. And in RAM? I don't know.
Mar
6
comment Why do /usr and /tmp directories for Linux miss vowels in their spellings?
I don't buy mmory nd dsk spc, but slow tltyps. As long s you cn dcphr th cronyms - why not?