General :: Find Directory Older Than X And Mv Directory With Sub Files Command?
Jul 13, 2011
I'm quite new to linux but I have configured a simple ftp server and it's working great. I have a FTP-Shared folder with upload and download subfolders. Under upload's and download's I have identical category subfolders like mp3's, movies, software etc. in both. As the guy's upload, I would like to create a line crontab where I can move all the content under /FTP-Shared/upload/mp3/* older than 14 day's to FTP-Shared/downloads/mp3/ recursively (Like in cp command), but the timestamp must be searched on the first directory and not sub files example: /mp3/Club Dance/CD1/Hallo world.mp3This is how far I got:[root@clients ~]# /usr/bin/find /FTP_Shared/upload/Mp3s/ -depth -mindepth 1 -mtime +14 -type d -exec mv -f {} /FTP_Shared/download/Mp3s/ ;This command moves the directory and files, but it is not recursively
Is there any command in Linux which will find a particular word in all the files in a given directory and the folders below and replace it with a new word?
Well, I am facing problem when doing lab questions.
I must use DLXLinux bundled in Bochs (bochs.sourceforge.net).
I am required to use the /usr/local directory.
In /usr directory, there is no directory named 'local' but there is one thing called 'local@'. So, when I try to use mkdir command to create 'local' directory in /usr , there are error "cannot make directory.....".
i need to know how to find number of files in a directory? is there any system calls in fedora 12.And i need to know how to perform a operation if the that count increases by one?
I am trying find files in a directory that contain numbers. I have tried ls /etc *[0-9]* but that doesn't work. If I cd to /etc and run ls *[0-9]* it almost works but it also includes results from within files. My last thought was to try: find /etc [0-9] -type f but this does not work either. My second problem is that I am trying to get list of files in a directory that were changed less than 10 hours ago, using grep, while leaving out directories. I am completely stuck with the second problem.
to all the pdf's in a directory and save each line of output to a text file. i.e. i want to collect each line containing "DOI" from every pdf in a text file. I am unable to understand bash scripting enough to write a for loop for this.
I want to run a cronjob every 15 minutes that checks a directory for files. If the directory contains more than ten files I want it to send an email to me.
All I have is this...
*/15 * * * * ls -l | wc -l | [filename] | mail -s "This is just a test" [email address]
I would rather not write a bash script. Is there an easier way to do this? I was looking into some commands like find and grep.
I need little help. I want to find all files with extension "*.tar" "*.gz" and "*.zip" and move all those files into "/opt/old" directory. I've tried this command:
I wanna delete a directory with its files and I wanna do that as follows: rm -r dirToDelete Unfortunately, I always get asked for EACH single file if I wanna delete this because it is write protected.... Is there a way to suppress this feedback message so that just the whole directory with its contents disappears?
I am looking for Windows Search equivalent looking for file name patterns (not file contents but file names)....
I am aware of "globbing" and wildcard recursive search functionality in ls but I am still not capable of finding files under directories.
for example: I want to find all files starting with a string lsnr* under root directory / and any sub-directories.....
ie I want to look for files like lsnr*.* anywhere under / and any sub-directories under / such as /dir1/dir2/dir4 and dir1/other/dir/someotherdir/sub-dir etc.
so if I have /dir1/lsnrcontrol and also have /dir1/dir/2/dir3/lsnr-tinit.dat then I want to list the files names etc.
What command will provide you with the number of files in your current directory? Choose one answer. A. ls -c B. ls | wc -w (this one) C. ls -n | count D. ls -wc (this one ?)
I am bulding my own image based on 2.6.32 kernel, I wish to add a guest user:
In a script thats invoked by the makefile, I use 'useradd' command & this updates the shadow, passwd files under /etc on the host, is it possible to tell the command to create the shadow / password under some other folder on the host? may be /tmp?
If I have a directory /foo with a few files in it, how do I symlink each entry in /foo into /bar/? For instance, if /foo has the files a, b and c, I want to create three symlinks:
I need to copy all subdirectories and files from one directory to another ever 5 minutes or so, with the old data automatically being overwritten with the new data. I'd also like this to run at startup. Is there any way this can be done? If so, what program would I need to schedule the automation and what is the command line I would need.
I have been trying to write a script that will take a directory, for example /accounts compress it into a .tar file with the filename containing the date of compression, for example accounts030210.tar and then place that file into a directory called /archive
I also want the script to delete files in /archive that are older than 7 days.
How would i go about copying files to a directory, yet skip the files that already exist in the directory, and also remove the files that are in the directory. For example:
Code:
$ls /dir1 img001.jpg img002.jpg
[code]....
Now i would like to copy from dir1 to dir2, but the contents of dir2 would be:
I learned a little bit about this command (du) to find out how much space a directory takes up but what I want to know is can you tell it to exclude directories?For instance, I wanted to know how large the / directory is on my old suse10 drive but I want to exclude /home (/home was not a separate partition on that drive).
following are log files which are existing, I have to delete one day older files from this location but when use above mentioned command it won't print one day older files, as i understand "-mtime" modified time, "+1" means one day older. am i correct?
Code:
-rw-rw-rw- 1 ablddb dba 268435456 May 30 17:11 mtsDB.log126985 -rw-rw-rw- 1 ablddb dba 268435456 May 30 17:17 mtsDB.log126986 -rw-rw-rw- 1 ablddb dba 268435456 May 30 17:23 mtsDB.log126987
I am trying to use "find" but I can't quite get all of the switches right for it to work. I have a folder that contains many folders. Let's call that original folder "MyFiles". The subfolders contain java files (and those subfolders possibly contain subfolders that contain java files). Here is what I want to have happen:
0. Create a file to print to, call it "output.ps" 1. Find all of the Java files in the MyFiles tree. 2. For each java file that is found, append it to output.ps along with it's absolute path name.
So far I have:
find . -iname *.java
and this finds all of the java files for me. But then I can't get the files to print to a file using exec.
Recently I mounted a larger partition into my home directory since I was running out of space, Everything went smoothly, but it caused me to wonder about something I cant figure out. While playing with the mount unmount commands when I was copying everything over... before editing my fstab.
Is there a way to access the files that existed in a directory before you mount a partition to that directory? after mount the original files are gone.unmount and they are back, Where do they go?
i want to copy a few files from my windows directory into the wine directory - its no big deal, just a few preference files so i dont have to set something up all over again. trouble is, i had the files copied, but i cant find the wine/ c: drive directory anywhere, anyone know where this can be found??
When I run "ls -al somedir*" (I use the "ll" shortcut, actually), Linux not only list files that match, but also the contents of directories whose name also happens to match.Is there a way to limit "ls" so that it will only show names (files and directories) and ignore the contents of the directories?
After i try to find logfiles follow date/month/year. i want copy this files to another directory with name's directory is time you find(date/month/year).
I am using my media server as my podcast collector. I am in the process of learning the ins and outs of NFS so i can mount a NFS directory and transfer my podcasts from server to player. For now i am using scp to transfer podcasts from server to desktop then to player. The problem is the path to the directory of one of the podcasts is /home/user/gpodder-downloads/The BILL&TIMMY Show Podcast.
whenever i try and run my scp command it fails because it thinks that TIMMY is a script i want to run in the background. I have tried to back-slash escape the character, i've tried single quoting and double quoting the character and i still get the same problem. as it sits now i have to move all podcasts to another directory and then transfer them to my desktop...but i would like to transfer the podcasts without un-necessary steps.