I have searched for a way to copy file less than X days old and I found this:http://www.howtogeek.com/howto/ubunt...days-on-linux/ The syntax for deleting files less than 7 days old would be like this:find /path/to/files* -mtime -7 -exec rm {} ;I would like to copy the files to mntas, and I'm not sure what the syntax should be.ould this work?find /path/to/files* -mtime -7 -exec cp {} mnt
as ;
I'm trying to truncate a postfix Maildata directory for one of our users. I want to be able to move any files older than <n> days to a new location, but also copying the relevant directory structure. This should be doable in the one comman. I've used find to locate the files, and mv to move them, but I can't figure out how to build the directoryt structure on the fly in the new location.
I want to run rsync on server A to copy all files from Server B when they are newer than 7 days.(find . -mtime -7) I don't want to delete the files on Server B.
I want to make the script to copy all folders which older than 7 days from Linux server to Windows server by Samba. And make it automatically by using cron
i am a newbie in linux ,i am writing a bash script to identify the files which are exactly 7 days ( a week old) i tried this command find /var/backup -mtime +7 -exec ls -d {} ;but this gives me even the files which are older than 7 days
I am trying to put together ksh shell and I am new with writing scripts.How do you write a command to delete any files if it's 30 days old and also it's not currently being locked?
find -type f /path/* -mtime +7 -exec rm {} ;Is this the best way to delete only files (not directories) within /path that are older than 7 days? or is there a better way?
I`m totally new to linux, in fact I`m a windows adminscenario:I need to run a script that will automatically move 30 days old files from particular folder to a particular folder.
When i installed ubuntu. I made a seperate partition so that i could copy an ISO image onto it of an up-to-date version of ubuntu. I wanted to then boot the ISO up so i could install the version that way.I've already tried doing it through the update manager but it'll download, almost be done with installing and it freezes on me. so i figured this would be easier. However i do not know how to gain access to the other partition to copy the ISO image.
I have many files and folders in my source folder. I want to copy some files and folders from that source folder to destination folder. What should be require to given with the "cp" command?
I have a script that moves files after 60 days from the FTP folder over to a trash folder which is not accessible by the FTP. From there I can delete the files whenever the drive get's full. That works fine so far. The only thing that bothers me is that files moved to ".Trash" are not in any folder structure anymore (one big directory with the deleted files in it).
When I do a "ls -la" on the array {} I see the file names including the folders. I'm not sure if the find command or the mv command forgets about the directories.
This is the script: bash -c 'date;find /Volumes/data1/test/ -mtime +60 -type f -exec mv {} /Volumes/data1/.Trash/ ;;date' >> ~/mylog
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
I want to capture a mms stream daily. All works well with that, but I also want to delete any mpg files that are captured from the stream that are more than 7 days old. Will this command work?
I need to move files to a backup drive if they are over 30 days old. All I could find, when looking for scripts, were ways to sort files by date and the solutions were all over the place and nothing seemed simple or good.
I've thought of building my own running "ls -al > filelist.txt" type of approach and then processing the file, but not sure that is best way. An array would be much easier and eliminate the file, but never done an array in bash.
I have a 160GB harddrive which I installed a F12, would like to upgrade to a bigger drive, but I hate to have to re-install everything.
Recommend a good disk copy utility? The utility should be able to not only copy files, but boot sector and everything. So I just need to make a copy, change my BIOS to boot from the new drive and run everything as before.
just installed ubuntu couple of days back on my netbook. I am still a beginner, enjoying my adventure exploring ubuntu. I have another desktop which runs on XP. I am able to access XP shared folders through my netbook(linux). However, i wanted to copy files from XP infact folders using TERMINAL in my netbook, not copy and paste using my mouse. Are there any commands for it?
Seem my rotation part is not removing files older than 90 days. Anybody know what is wrong?
Code: #!/bin/sh #navigate to the desired backup location cd /public/backup/linux #dump the MySQL entirely, output file is dated mysqldump -u root -pmt1jxz68f2 --all-databases > "`date +%Y%m%d`.sql" #backup the web folder
I have set up a simple find and delete script for files older than X days. The problem is that some of the files that are send in this share are transfered from an archive server and creation/modified date remains the same when copied and the age of them could be a year ago or older and they get deleted over night by the script.For performance reasons the raid is mounted with noatime in fstab.Do you see any solution to this problem except enabling atime?I'm thinking at some more advanced script that writes the list of added files once a day and marks them for deletion after some time.
I'm trying to copy files to the /var/www folder on Ubuntu 10.04. But I think I don't hava the permission. How can I do this? Maybe I have to set the rights permissions.
Possible Duplicate: Linux equivalent to robocopy? I have two websites - one is basically a development version and the other is a production version of the same site. So I'd like to be able to merge the changes made to the development site based on the modified date of the files. Is this possible with the 'cp' command?
At the moment I'm using:"cp -ap . /destination-folder"to copy everything from the folder I'm in to another folder.That works.Is it possible to cp everything except:folder1/folder2/in the current folder I'm in?
Now I have learned creating partition in linux (ubuntu), well that's an achievement for a newbie. The next thing that I want to know is, how can I copy the contents of a partition to another partition. Like if I want to backup its content to a new partition that Im going to create.