General :: Loop Through A DIR To Delete Files By Inode
Feb 9, 2010
I have a directory that contains some files (over a 1,000) that have a '' in the filename. There are also some good files that I need to keep. therefore I need a script to delete based on inode.
What I have thus far:
list="$(ls -il /opt/PC/log/*RPOUT*.xml)" #this gives me the list
# I need to get the inode of.
for i in $list
do
find . -inum $i -exec rm -i {} ;
echo "delete file" $i >> /home/me/tmp/del_inode.txt
done
echo 'completed'
I know this is not right ... what I know is is the 'find' is. I need to loop through the $list gleaning inodes to get all the files with '' delete. I'm not sure how. The $i gives me the whole line. I just want the first position. set $() does not seem to work ...
I decided to take an old Gateway that I bought off a guy cheaply and turn it into a file and web server.I purchased copies of Debian 5.0.4 i386 disks (31 in all) on the advice of a friend, the disks weren't expensive, but now that Ive installed all the disks, I'm having a variety of errors
[443.110940 end request: I/O error, dev hde, sector 76021855 [443.111074] EXT3-fs error (device hde1): ext3_get_inode_loc: unable to read inode block - inode=2375715, block=9502724 INIT: cannot execute "/sbin/getty"
I am downloading online videos with a bash script this is the code of script test.sh:
Code: Select all#!/bin/bash while read line do "/usr/bin/wget" $line sed -i "/$line/d" urls done <urls
The while loop read the videos url from the urls file and parse them to the wget for dwonlaod, i write the wget for easy of exmple in this code otherwise i use another script to downlaod the embed videos , the code
Code: Select allsed -i "/$line/d" urls delete the url of videos from the urls file when it is download is complete.
The problem is http address contain the foreward slashes "/" and sed cannot delete them and get error, this is the urls file:
I have hundreds of files in one directory, is there a simple command or pipes of command I can use to append them together? I don't want to use any loops.
I was using gparted from a live usb to resize an ext4 partition and it failed while running resize2fs. The error it gave was
Code: resize2fs: The inode is from a bad block in the inode table while trying to resize /dev/sda5 please run 'e2fsck -fy /dev/sda5' to fix the filesystem after the aborted resize operation.
I am trying to use an old box as backup server. I have tried a couple of possibilities along the lines of:
Quote:
rsync -a --delete --progress --log-file=/home/$USER/info.txt -e ssh /home /etc root@192.168.0.106:/mnt/back
The problem is it does not delete files that has been removed from my local system? I run the command as root on the local system.
(I realize I should properly not ssh into the server as the server's root but I'm having trouble with the permissions and I want to make sure everything else works before messing around with it)
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.
I'm trying to keep a directory full of log files manageable. Nightly, I want to delete all but the 10 most recent. How can I do this in a single command?
I have a script running as a cronjobIt outputs logs upon each run to /var/log/mylog.logIs there anyway I can delete this or compress it when it gets too large?A cheap and dirty way is to setup another cronjob to delete the log every X interval.... although I'm not sure if that's the proper way
I would boot up windows and do it but window will no longer open my system crashed and was only able to recover linux. i open up system info and 31 gig of memory are used up on windows. i try to delete them but the option doest pop up and the delete key will not work. how can i remove all the windows files without deleting any of my linux stuff? if its possible.
i wanna ask on how to delete a file or a certain file in linux by using php or in other word by using web browser. example i want to delete the file inside /var/www/cgi-bin/ with browser.
I have a USB drive that I boot using SysLinux. I think select one of several options to complete a task. I do not have access to edit those Kernels. I need to add a option from the Syslinux menu where I can delete all the files from a specific directory.
I created a directory somewhere with permissions rwxrwxr-x so that other users in my group can create files and directories in it.
I do need to be able to delete the contents in this "public" directory, but it seems that while I am able to remove any files in this directory I cannot remove and subdirectories under it.
Is there a way to remove such subdirectories owned by others under a directory owned by me?
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 ?
I just installed Fedora11 with the KDE desktop and completed a yum update. Every time i try to copy and paste files and even delete files from a file manager or my desktop, I get this error:Quote:Could not start process Unable to create io-slave:klauncher said: Error loading 'kio_trash'.or thisQuote:Could not start process Unable to create io-slave:klauncher said: Error loading 'kio_file'.orQuote:Could not start process Unable to create io-slave:klauncher said: Error loading 'kio_desktop'.Current KDE version is 4.2.2
I run 5GBFree.com a free hosting site. As you can imagine, it gets quite a few people signing up to abuse the service.Recently I've found a LOT of people setting up sites with a particular script that floods forums and IRC chat rooms. The names of the files are as follows:
Is there a command I can run to remove files with these filenames ANYWHERE on the server (so basically, a command to go through all folders on the server and remove instances of that name
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 am trying to delete multiple files from sftp with non-interactive way as per the desire ext. But i am not able to get the proper extension of the files for removing files.
lftp -u ${user},${passwd} sftp://${ip}<<EOF cd ${path} rm *${ext} bye EOF
I am using ubuntu 8.04 and have a separate home partition. While setting it up I had a few failures and was left with several directories containing many hidden files which I can't seem to delete. The man pages for 'rm' didn't seem to provide the answer either.
Is there a flag or escape sequence that will allow 'rm' to delete these files?