Search Members Help

» Welcome Guest
[ Log In :: Register ]

Mini-ITX Boards Sale, Fanless BareBones Mini-ITX, Bootable 1G DSL USBs, 533MHz Fanless PC <-- SALE $200 each!
Get The Official Damn Small Linux Book. DSL Market , Great VPS hosting provided by Tektonic
Pages: (2) </ 1 [2] >/

[ Track this topic :: Email this topic :: Print this topic ]

reply to topic new topic new poll
Topic: Script required to delete a list of files?, Undo mistakes in multi-app extensions< Next Oldest | Next Newest >
Juanito Offline





Group: Members
Posts: 1601
Joined: Sep. 2005
Posted: April 22 2008,08:38 QUOTE

Thanks:
Code Sample
$ for F in `cat files_list`; do echo "$F"; done [to test/double-check]
# for F in `cat files_list`; do rm "$F"; done
- does indeed delete the files in files_list

On a connected topic:
Code Sample
$ tar -tzf ../myapp.dsl > files_list
- will produce a list of files without the leading "/" required by the delete loop above. Is there a way to have the leading "/" without adding it by hand?
Back to top
Profile PM 
mikshaw Offline





Group: Members
Posts: 4856
Joined: July 2004
Posted: April 22 2008,12:54 QUOTE

The leading / is removed when the package is created.
Probably the easiest thing to do is "cd /" before removing files.


--------------
http://www.tldp.org/LDP/intro-linux/html/index.html
Back to top
Profile PM WEB 
^thehatsrule^ Offline





Group: Members
Posts: 3275
Joined: July 2006
Posted: April 22 2008,17:25 QUOTE

fyi, those code snippets would only work on filenames not containing whitespace.
You could set IFS to newline or use `while read LINE; do echo $LINE; done < filelist ` (which can be more resource friendly afaik)
Back to top
Profile PM 
mikshaw Offline





Group: Members
Posts: 4856
Joined: July 2004
Posted: April 22 2008,17:39 QUOTE

also, an alternative to cd:
while read LINE; do echo "/$LINE"; done < filelist


--------------
http://www.tldp.org/LDP/intro-linux/html/index.html
Back to top
Profile PM WEB 
8 replies since April 13 2008,05:56 < Next Oldest | Next Newest >

[ Track this topic :: Email this topic :: Print this topic ]

Pages: (2) </ 1 [2] >/
reply to topic new topic new poll
Quick Reply: Script required to delete a list of files?

Do you wish to enable your signature for this post?
Do you wish to enable emoticons for this post?
Track this topic
View All Emoticons
View iB Code