Programming :: Find A Dir And Delete It?
Apr 19, 2010
I've got this line find . -type d -name 'elements' -exec rm -rf {} ; put together to find and delete all directories named elements and their contents.
It does work but whenever I run it I get the error/warning
Code: find: `./dir3/elements': No such file or directory
find: `./dir6/elements': No such file or directory
[code]....
View 4 Replies
ADVERTISEMENT
Mar 23, 2010
I am trying to edit a print file.
For every occurence of the ^L form feed character I need to remove 5 blank lines after it but still keep the ^L.
I am a rare user of sed and am ok with the basics but am struggling with this.
View 4 Replies
View Related
May 3, 2010
I have a file with a number of strings like the ones below
string1#m1asdfe23easdf23wefas
string2#mfaaeb2vr1rhserh
anotherstring#ji89ensrsegr
anotherone#m1ynmdt324nsdt
I'm trying to delete everything after #** so that
string1#maasdfeaveasdfawefas
string2#mfaaebvrserhserh
becomes
string1#ma
string2#mf
tried sed 's/#..*//g' but as you all will know it returns string1, string2 etc.
View 12 Replies
View Related
Mar 4, 2011
I have a program that creates and uses a shared memory segment. I am trying to find out how to detach and delete this shared memory segment when I hit crtl-C, and I still need the process to terminate.shmdt() and shmctl() have variables that are local to the main passed to them(shared and shmid)
Code:
//Prototype
void leave(int sig);
//part of code trying to use signal handling
if(signal(SIGINT, leave))
[Code]...
View 3 Replies
View Related
Jan 21, 2011
I recently started shell programming and my task now is to do a menu display.Currently i am stuck whereby user will input both title and author and it will delete it.
Do i have to use sed command?
View 4 Replies
View Related
Apr 13, 2011
I want to use the shell to find .zip files in my music directory and all sub directories and then delete only these files. The following will find the files I want to delete
Code:find /home/me/Music/ -name *.zip -lsWhat is the next step to delete *only* these files.Would it be a good idea to move them to another directory before doing the final rm - how would I do this
View 6 Replies
View Related
Oct 31, 2010
Where can I find add/delete software in Yast. When I use Gnome I see this entry and on KDE 4.4 that entry seems to be gone.
View 3 Replies
View Related
Dec 21, 2010
I have a bunch of text files, all of them have a .txt extension. They are all located in subfolders of the /MyTextFiles folder (but could be anywhere, no idea what depth). If any line in any of the text files has the word "hello" I want to delete that entire line. I know sed and awk are made for this problem but I can't seem to get the syntax correct.
View 1 Replies
View Related
Aug 18, 2011
I want find a bunch of log files and delete ones that are older than say 5 days. Ideally I would then like to add this my crontab to run once a day.
The log files are in /var/log and are owned by root. They have a standard naming convention which is [date]RootCronRsync-backupHOME.log An example file is 20100621RootCronRsync-backupHOME.log Trying to put together a bash script to do this I think I need something like
Code: find /var/log/ -name *RootCronRsync-backupHOME.log -mtime +5 -exec rm {} ; However if I try this without the -exec rm (ie to see if I can find the right files first) I get the following error find: paths must precede expression: 20090405RootCronRsync-backupHOME.log Usage: find [-H] [-L] [-P] [-Olevel] [-D help|tree|search|stat|rates|opt|exec] [path...] [expression]
View 8 Replies
View Related
Apr 27, 2011
I am trying to find and delete a file using this Code: find . -type f -name ph2964781400100954291.jpg -exec rm -f {} ; It does not work, I think because by default on my distro rm is iterative.
View 2 Replies
View Related
Aug 2, 2010
I have about 1TB of data to sort out and need a good GUI package to find and safely delete the duplicate files. I am running Ubuntu 10.04 amd_64. Would appriciate any thoughts on how to get it done.
View 8 Replies
View Related
Jun 4, 2010
My bad it was the game not the controller I figured it out. I can't find a delete button though..........
View 1 Replies
View Related
Mar 6, 2010
I have a series of file names in a text file that I generated by running
Code:
bash-4.1# ls -alt *.txz | awk '{print $8}'
and then copy pasting the output. All of these file names have the version number
Quote:
-4.4.1-x86_64-1alien.txz
I just want a method to remove that version number from all the filenames so that I can then add all the packages without version numbers to a blacklist file.
I've tried kwrite and mousepad and both have a search feature and a replace feature but I haven't been able to just have the text removed successfully.
View 3 Replies
View Related
Oct 12, 2010
I recently moved to a new machine, and I copied my entire home folder across. This included lots of hidden (starting with '.') folders, and in many cases they are config folders for packages which I have not installed on the new machine. They are taking up space, so I would like to delete them, but to go through manually and figure out which ones I need would be very laborious. Is there a way to find, and perhaps delete, config folders for packages that are not installed?
View 2 Replies
View Related
Aug 17, 2010
I have a directory containing a ton of photos, some of which are duplicates but just with different names. Is there any way in linux to find all the duplicates and remove all of them except the most recent version? I know on Windows there are utilities that will do this through a GUI, but I'm using Linux through the CLI only.
View 6 Replies
View Related
Jun 24, 2010
I need to find a string in a file ... then delete the line it is on, as well as the next 6 lines. Or, delete the line the string is on and all subsequent lines until the search finds the character "["
example:
filename = test.txt
contents:
[foo]
test>test
test>test
test>test
[Code]....
so, in this example. I'd like to search the file for string 'foo' and delete all lines from that line until [bar] (not deleting the line with [bar])
View 3 Replies
View Related
Sep 1, 2011
I installed ubuntu today by installing Wubi and after downloading i rebooted computer and selected ubuntu but i got an error saying 'Try (hd0,0): FAT16: NO WUBILDR' and there was few more but i forgot and at the end it says 'Cannot find GRLDR in all device Press CTRL+ALT+DELETE to restart'. it used to work when i had vista...
View 3 Replies
View Related
Jul 1, 2010
I have the following string 1524)), I want to get rid of the parentheses. I have tried SED and AWK without success.
The last I tried was: echo "1526))" | sed 's/)).*$//'
View 4 Replies
View Related
Jan 6, 2010
I've modified a program to show * instead of letters when typing a password. I'm trying to make it so that when pressing backspace a * will be removed.Here's a rough example. The problem is that when trying to do this in the real program,' is not recognized as backspace.
View 6 Replies
View Related
Aug 27, 2010
These must a be a question you received a lot, but I couldn't find a similar thread! It's a simple question.
I need to delete a specific string from a file. For example the specific numbers "3456" from a file. I've tried with the tr comand, using
Code:
tr -d '3456' file,
but it also deleted whichever ocurrence of 3,4,5,6 from my file. Should I use a regular expression?
View 7 Replies
View Related
Dec 5, 2009
I'm using rmdir(), and everything goes ok if the directory is empty, ?how can I remove the entire tree when i have other files or directories in the folder that I want to delete?I've read about using "system(rm....)" but i REALLY want to do this without it, is it possible?
View 4 Replies
View Related
Apr 1, 2011
if the given pattern exists in the file with the very next line starting and endingwith the same pattern , delete the line that starts and ends with the given pattern.So upon running on this file
hai people<PATTERN> we had
<PATTERN>a lot of fun<PATTERN>
writing scripts
[code]....
View 6 Replies
View Related
May 15, 2011
My problem is like this I have to delete all lines between two pattern match example- suppose below is the content of the file then i have to delete all lines between text1 and text2
...
text1
abc
def
ghi
[Code]....
View 14 Replies
View Related
Aug 13, 2010
I have 50 files in the following format.
fileone.0001.txt
filetwo.0002.txt
filethree.0003.txt
[code]...
View 4 Replies
View Related
Oct 13, 2010
I want to delete lines which contain the word "Fehler" but for some reason my programm isn't working:
Code: BEGIN { FS="|"
OFS="|"
SUBSEP="|"
[code]...
View 6 Replies
View Related
Oct 17, 2010
A sed mishap prior to a database import left me with a table name with, eh, well, this: Code: mysql> show tables;
+-------------------+
| Tables_in_someday |
+-------------------+
| day20101016 |
| day20101017); |
+-------------------+
I've corrected the sed mishap and imported the database the way it was intended Code: mysql> show tables;
+-------------------+
| Tables_in_someday |
+-------------------+
| day20101016 |
| day20101017); |
| day20101017 |
+-------------------+
But I can't seem to drop the table day20101017); because no matter how I seem to escape it it errors.
View 1 Replies
View Related
Jan 3, 2011
I am new to unix, I am looking for a script to delete files older than 7 days but i also want to exclude certain directories (like arch,log .....) and also some files with extensions ike .ksh, .ch, ..............) in directories and sub directories
View 4 Replies
View Related
Apr 9, 2011
I would like to delete a single line from a file that contains many lines passing through the same values as the two parameters. Again, I would like to delete a single line and not all those that contain parameters. How can I make bash?
View 14 Replies
View Related
Sep 6, 2010
I have designed a simple mail client to download messages/data to a file.
The server type is CAPA STLS which means can handle noncrypted and encrypted logins.
I have a problem which is that POP3 CAPA STLS mail server does not want to delete messages. It deletes the messages on the non STLS side.
For an STLS session, I receive the +Ok for a Deleted message.
Language C, Library openssl, IP4.
Compiler: gcc.
View 1 Replies
View Related
Aug 4, 2010
Delete this with maximum prejudice, mods.
View 1 Replies
View Related