General :: Find Folders With ONLY One Specific File In And Delete File And Folde
Oct 21, 2009
Many folders within a subdirectory some of which have lots of data in and some of which have only one specific file called produkt.fil inside.I need a command to find and delete those folders that contain ONLY the file produkt.fil - if other files exist (doesnt matter what they are) then they should be left alone. Note: produkt.fil exists in all of the folders always.
View 5 Replies
ADVERTISEMENT
Oct 3, 2010
Many years ago, I converted a portion of my files to an arbitrary format with a specific extension. i no longer desire to have them in this format and i would like begin the process of replacing them because conversion is not an appropriate solution. unfortunately, they are mixed in separate folders of the same root folder with files in my current format of a different extension. I feel it would make this process easier if I were to move every folder that contained a file with the undesired format to a separate root folder. The files are stored on a Linux server and shared via samba. How can I do this with a couple of commands or a script? I am open to other suggestions as well. I want to avoid time spent editing text files. Ultimately, I'd like a command that produced a list of full paths for folders, sorted by the number of levels would be a nice touch. A list of all of the files is clearly not what I'm looking for.
View 2 Replies
View Related
Aug 31, 2011
I'm using bash under Ubuntu.Currently this works well for the current directory:catdoc *.doc | grep "specificword" But I have lots of subdirectories with .doc files.How can I search for, let's say, "specificword" recursively?
View 2 Replies
View Related
Feb 3, 2011
I have the tar file of glibc-2.12.1, but now I want to edit the SPEC file. I can't find it. For those that want a "why", I'm trying to make it smaller. So simply, where is the SPEC file for glibc? (rpmbuild cannot find it in the *.tar.gz file).
View 4 Replies
View Related
May 7, 2010
Is there any way i can find a file with specific word inside it.For example if i want to find a file which has some text written inside it.How would i form a command to search them?
View 5 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
Apr 25, 2011
Currently I am doing a java project and I renamed some file/folders to start with '.'. i.e. ".project", ".classpath", ".settings/"
I can see them on my desktop but i cannot delete them. In the terminal, "ls" command does not show these files exist. "rm" will also say cannot find these files. How do I get rid of these files/folders?
View 3 Replies
View Related
Jun 27, 2010
On my RHEL5 system one of my key file in one specific directory gets deleted when I start my application suite (having multiple processes). Is there some way to narrow down which specific process is deleting this file?
View 8 Replies
View Related
May 14, 2011
I want to know where to find a specific file in Ubuntu. I have the file name but I don't know where to place it to bring up the file.
View 9 Replies
View Related
May 11, 2010
I used a script that renamed my file eg 'echo webutil.olb | tr [A-Z] [a-z]' i wanted to rename it back to webutil.olb. How do i do this for many other files that i have
View 3 Replies
View Related
Feb 1, 2010
I know that every .desktop file comes into the Applications section but how can I find the .desktop file for a specific application?
View 5 Replies
View Related
Jul 30, 2010
When I ls -l /etc/passwd, -rw-r--r-- 1 root root /etc/passwd When I login as myself, and rm /etc/passwd, it asks: rm: remove write-protected file '/etc/passwd'? If I say yes, will it actually delete the passwd file?
View 1 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
Nov 4, 2009
I have a file with tens of thousands of lines. I need to remove specific letters eg eggs, from every line that has the letters in it. Is there a command which can help me do that easily?
View 4 Replies
View Related
Jan 21, 2010
How do I delete a file if it happens like this.
-????????? ? ? ? ? ? temp.cgi
View 5 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
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
Oct 14, 2010
I want to be able to check the contents of a text file for a specific string and remove it from the file from the command prompt. I would basically be searching through a number of files and if a specific string is found I would like it removed automatically. pretty much a find and replace, were the replace is nothing. any one got any ideas on how you would do this. I already have the search part sorted just need to be able to remove the string I don't want from the multiple files.
View 4 Replies
View Related
Apr 10, 2011
How would you create and then delete a file that begins with the symbol "-"? Try it.
I can't write the command for this question and I don't why.
View 3 Replies
View Related
Jul 26, 2011
i'm just curious if i can search for the dir/file pattern in the single "find" command?
here is an example:
dir1/dir2/dir3/file.txt
dirXX/dirYY/dir2/dir3/file.txt
dir1/dir4/dir3/file.txt
i want to search for the pattern "dir2/dir3/file.txt"
View 12 Replies
View Related
Jan 4, 2011
i want to find a command line way to edit a text file to delete all commas in the file. i do not want to replace them w/ anything.
View 2 Replies
View Related
Sep 17, 2009
I am trying to delete lines of a file if they contain text that is present on another file. For example
> cat one.txt:
a
b
c
d
[code]....
I get the following output:
> ./test.sh one.txt two.txt
a
b
d
e
[code]....
View 6 Replies
View Related
Apr 4, 2009
I am developing a Web-based application and have some folders that will generally reside outside of the Web accessible area of the server. However, since some people will not be able to store those folders outside of the "public_html" folder, I am looking to put a blank "index.php" inside of every folder within that section of the application. To make things easier, I would like to know if there might be a way to recursively copy one file into every folder in a certain location.
In other words, is there a command that might do something like:
Code:
> cp -R index.php /home/user/public_html/source-files/*
Basically, I want every directory inside of "source-files" to get a copy of "index.php". The directory hierarchy within "source-files" can go at least three or four levels deep, so the command would need to be recursive. I am looking for a command-line statement that I can type to perform this action.
View 3 Replies
View Related
Aug 31, 2010
Is there a way to add files/folders to a tar file?
I am using the tar command for compression.
View 2 Replies
View Related
Nov 30, 2010
we assume that we have 2 folders with the name 1 and 2 . The folder 2 is inside 1 . Also, in folder 2 we have file with name "file.txt". And we are in folder 1 . How can we delete the file.txt in one command line ? I mean without using the code below:
Code:
cd 2
rm -f file.txt
cd ..
View 3 Replies
View Related
Apr 11, 2011
Is it possible to write ksh script in the spec file? The target is after I perform
rpm -i my_rpm.rpm
According to the spec file, ksh script will do some installation & configuration. For example run other script and edit some files.
View 1 Replies
View Related
Jun 28, 2010
I need to copy a file into a Flash memory which is connected to my computer via USB. The file must start at a specific sector.
Can anyone guide me how to do this? (it can be through a C program, a line command, or any other way)
View 8 Replies
View Related
Jan 13, 2011
i have created a file (by root user) called test.txt. Then i created a user bob. Now i want only bob to read/write/execute this file and no other user shall have any permission on it.
View 3 Replies
View Related
Apr 4, 2011
I have a dir (pub_html) with 45 sub dirsand in each there is a file with name file123.html) what command can I use to rename all files with this name in all sub dirs to file456.html ? I'm on opensuse 11.3
View 14 Replies
View Related
Nov 23, 2010
How do I make a .zip file that contains every file AND every folder in the directory?
View 4 Replies
View Related