Reputation
4,253
Top tag
Next privilege 5,000 Rep.
Approve tag wiki edits
Badges
13 37
Newest
 Nice Answer
Impact
~862k people reached

Mar
18
answered How do I reuse the last output from the command line?
Mar
18
answered get numeric ASCII value for a character
Mar
14
answered Find a file in the path without “which”?
Mar
12
comment Deleting all files in a folder except files X, Y, and Z
You're right, I'm sorry.
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?