Ubuntu :: Delete Files In Trash That Is Older Than 10 Days With A Terminal Command?
Sep 27, 2010Can I delete files in trash that is older than 10 days with a terminal command?
View 3 RepliesCan I delete files in trash that is older than 10 days with a terminal command?
View 3 RepliesI 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 RelatedI 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?
View 10 Replies View Relatedfind -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?
View 3 Replies View RelatedI've been trying to delete all files older than 7 days in a directory temp1.I have try different ways but nothing happend:
find /temp1/* -mtime +7 -exec rm rf
find . -mtime +7 -exec rm rf
find /temp1/* -mtime +7 -print -exec rm{}
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.
View 2 Replies View RelatedI'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.
This is what I have so far:
Code:
find /Maildata/editor -mtime +42 -type f -exec mv -v {} /EditorEmailOld/ ; > ~/editor.txt
I got this part from my script working that it will delete a folder is from 8 days agoEightDaysAgo=`(date --date="8 days ago" +%d-%m-%Y)`rm -rf $EightDaysAgoTarHowever I need to remove files that are older than 8days for example if the script is'nt run for a day it will remove both the 9th and 8th day one not just the 8th day one. If I'm making any sense lol
View 3 Replies View RelatedI 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.
I am having my own testing server in which mySQL database will be backed up daily. in the format mysql_backup_dd/mm/yy.tar.gz in my home folder I need to setup a cron job to delete the backups older than 7 days.how to do this.
View 3 Replies View RelatedSeem 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
[Code]...
I just can't stand knowing that there's a slight problem with my PC.I have roughly 12.5 Gigs of files, mostly movies that are multiple clones of a particular movie (which was an entirely different problem altogether) and I CANNOT DELETE THESE THINGS! There has to be a simple way to do it from terminal, problem is, I can't seem to find the trash directory in terminal.
View 3 Replies View RelatedI 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?
Code:
#!/bin/bash
find /mnt/tera/all_video/thai3 -ctime +7 -name "*.mpg" -exec rm -f {} ; -ls > /var/log/thai3.log 2>&1
[code]....
I am looking for a way to permanently delete files immediately - no trash, no taking up space but a command to make a file immediately gone. I have a USB flash drive and it has a hidden .trash file on it that builds-up until I have no more room on the flash drive - all space taken up by deleted files. I need a command that bypasses the trash and immediately deletes a file for good making space available.
View 5 Replies View RelatedI can't delete any files bigger than 4 Go. I got a message telling me that my trash is full and I should empty it. But there is nothing in it. Is there any thing I can do to be able to delete files over 4 Go?
View 5 Replies View Relatedi have an issue due to some high security requirements. what i want to do is to remove the files in trash folder permanently from the memory so that they cannot be recovered again. am aware of the "shred" command but i dont know if it can reach to files that are already in trash.I have found a solution but it requires to fill the whole unused memory with a file that consist of some ramdom bits and than deletes it:
dd if=/dev/zero of=zero.small.file bs=1024 count=102400
shred -z zero.small.file
cat /dev/zero > zero.file
[code]...
Possible Duplicate:How do I delete files greater than a certain date on linux How to delete all files in current directory and it`s sub directories older than one year ?
View 2 Replies View RelatedI hope that I'm posting this thread in the right place. This involves a very unique problem which has caused the .Trash-1000 folder for my external USB drive to become corrupted, to the point of causing massive heat problems which then causes my system to crash, i.e. become completely inoperable, forcing me to do a hard reset.
The scenario: Recently I went through all of my backup data which is what I use that external USB drive for. After finding several GB of data files, some dating back 2 - 3 years from a root server that I used to have, I went ahead and tried to delete all of those files. Well, with exception to 3 folders, containing no more than perhaps 35 files which totalled less than 8 MB in space, everything was deleted properly without a hitch. The files that couldn't be deleted prompted some strange "couldn't delete blahblahblah file due to input/output error" message. One message for each file that couldn't be deleted.
Now mind you, I can open these files, look at them, rename them, copy them, but I cannot delete them. Still being pretty wet as far as Linux is concerned, I tried numerous suggestions that I could find on the internet, all of which had to do with file permissions in one form or another. I've tried everything that made any sense and still can't delete those files.
All of the data is my own, all of the hardware is mine, and I'm the only one using this machine. I'm not attempting to do anything illegal. Then I figured, smart as I am, why don't I just assign ownership of the .Trash folder to myself via the chown -R command, followed by deleting the files afterwards. Okay, the chown command gave me no error, I assumed all was well since it's my USB drive to begin with and since it automounts during every restart anyway. I just figured that this would be something to try. BIG MISTAKE !!!
My system runs just as perfectly as before, with but one exception. NOW, when I attempt to delete those files that I couldn't delete before, I don't get an error message anymore but the CPU starts hyperventilating during the deletion process which goes on endlessly (remember, we're taking about less than 8 MB of data) ... ultimately causing the system to crash, i.e. become totally unresponsive. NOW, if I delete additional files from that USB drive and then attempt to empty the trash, the newly deleted files take substantially longer too now. Not as long as the original "bad files" but still quite long. The drive itself checks out fine and it's not a dual-boot system with Windows. Just did a virus check recently too and everything checks out in that regard as well.
Can someone tell me how to reassign whatever original values there were for that external drive .Trash folder? I think if I could restore those values to whatever they used to be before I used the chown -R command, perhaps then everything would be fine again as far as the crashing is concerned. HELP ....
(Please take a look at the screenshots too)
The last screenshots shows "preparing to delete" which takes a very long time. Then it takes anywhere from 15 to 45 seconds PER FILE before that miniscule file is actually supposedly deleted. Eventually, after a few files are deleted, the system crashes. I wrote "supposedly deleted" because after a reboot the files are still there .
ubuntu 11.04
ubuntu classic
wubi
When I try to delete a file in the host directory (and sub-directories), I see the prompt, 'Cannot move file to trash, do you want to delete immediately?'
I googled this issue and see some solutions that require editing fstab, but not sure if that's the right approach in wubi, and not so sure what edits I would make in fstab anyway.
I have server running ubuntu. There is folder /var/netflow and I have there files, which creates every 5minutes new ones(monitoring traffic on network). And I need to delete files older than 6 months manually. Can you help?
View 2 Replies View RelatedWhen I am deleting pictures using gThumb image viewer it asks "The selected images will be moved to Trash, are you sure?" And if I press "yes" button - it moves message to ~/.Trash, can it be configured to move them into "real" trash? I have created symbolic link and it solved part of my problems, but files "restore" option is unavailable to files which were moved in to trash by this method.
View 3 Replies View RelatedI edited fstab so that my Windows disk partition will be automatically mounted when I log on. However, when I delete a file from said partition, I am told that the item(s) cannot be moved to trash - I can only permanently delete files from the Windows partition. Here is how I configured in fstab: Code: /dev/sda1 /media/Vista ntfs nls=iso8859-1,umask=000 0 0 I suspect I mis-configured the options. Can anyone see an issue?
View 1 Replies View RelatedI typically use rm to delete files, but they don't end up in my trash folder in case I want to recover them. How do I make that happen and how do I access my trash folder via terminal? Doing me best to work from terminal rather than GUI and this one has me stumped. I am using Mint Julia.
View 2 Replies View RelatedCommand to find all of the files which have been accessed within the last 30 days?
View 1 Replies View RelatedInstead of moving to trash, how can i make the delete button delete? Delete is already enabled on the right click menu.
View 7 Replies View RelatedI 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
View 4 Replies View RelatedI mount /home on a logical partition. Files and directories that I trash from here go nicely into the recycle bin, and I can right click on it and choose "Empty Trash" with no problem. Files off of the root directory in directories that I "own" (i.e. /mydir/*) do not play as nicely. I went ahead and followed instructions from another post, namely:
Code:
sudo mkdir /.Trash
sudo chmod 1777 /.Trash
And after trashing some files from /mydir, there is indeed a subdirectory with my uid (1000) and files that I trash from /mydir are going in there. However, the recycle bin on my desktop remains empty, and the only method I have for deleting said files is by deleting them from the /.Trash/1000 folders through the command line. So my question is: Is there anyway that I can trash files from /mydir, see them appear on the desktop recycle bin, and empty the trash without the need to rm them directly through the command line? Not sure if it will help, but here is my fstab:
Code:
# / was on /dev/sda1 during installation
UUID=4129f389-92be-459e-8bbc-928c1440f718 / ext4 errors=remount-ro 0 1
# /home was on /dev/sda6 during installation
UUID=6a30914d-04a3-4b03-85bd-2bf16a68a41a /home ext4 defaults 0 2
# swap was on /dev/sda5 during installation
UUID=f388cf04-bbd6-4bf9-9d69-0778b0f158fd none swap sw 0 0
I have just accidently deleted /usr/lib as root, how do I restore it from the trash can from command line? Seeing as how no programs will now run. I can't seem to find /root/.Trash, no such folder seems to exist ,or did I just royally screw myself?
Edit:
First off where is the Trash folder for root in Fedora 11 I have googled and looked everywhere I can't get a straight answer. It is not in /root/.Trash for one.
KDE 4.6 - opensuse 11.4.
I have a separate ext4 partition which contains all my data (music, movies, etc). When I delete files from this partition it is very slow because it copies files from my data partition to the Trash folder in my home partition. How can I avoid this? Can't the trash be configured so that it uses a trash folder in each partition instead of copying files to another partition (which is slow).
Using Fedora 14 with Gnome 2.3 Desktop utilizing Compiz and Emerald theme manager. When I empty the trash, the icon is still the FULL Trash icon. I tried using different Emerald Themes, and different Icon sets, but still the Trash Icon stays full. I checked the trash folder in $HOME/.local/share/trash and found nothing, no hidden files.
View 3 Replies View Related