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 ...
View 5 Replies
ADVERTISEMENT
Mar 25, 2010
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"
[Code]..
View 2 Replies
View Related
Aug 14, 2014
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:
Code: Select allhttp://download.wavetlan.com/SVV/Media/HTTP/MP4/ConvertedFiles/Media-Convert/Unsupported/test7.mp4
http://download.wavetlan.com/SVV/Media/HTTP/H264/Talkinghead_Media/H264_test3_Talkingheadclipped_mp4_480x360.mp4
http://download.wavetlan.com/SVV/Media/HTTP/H264/Talkinghead_Media/H264_test4_Talkingheadclipped_mp4_480x320.mp4
http://download.wavetlan.com/SVV/Media/HTTP/H264/Other_Media/H264_test8_voiceclip_mp4_480x320.mp4
This is output of the test.sh:
Code: Select all# ./test.sh
http://download.wavetlan.com/SVV/Media/HTTP/MP4/ConvertedFiles/Media-Convert/Unsupported/test7.mp4
sed: -e expression #1, char 8: unknown command: `/'
http://download.wavetlan.com/SVV/Media/HTTP/H264/Talkinghead_Media/H264_test3_Talkingheadclipped_mp4_480x360.mp4
[Code] .....
View 3 Replies
View Related
Jun 12, 2011
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.
View 4 Replies
View Related
May 10, 2011
I am trying - to no avail - to take an old script I found in the forum help-needed-in-grep-for-tar-gz-658730/ The code:
Code:
#!/bin/bash
if zgrep $1 $2 > /dev/null 2>&1
[code]....
View 3 Replies
View Related
Oct 11, 2010
I am trying to dl the files located here: http://good.net/dl/bd/CCCamp-2007/video/m4v/ using wget.
Now when I use the command wget -r -A .m4v http://good.net/dl/bd/CCCamp-2007/video/m4v/
I get the just a bunch of filefolders, but no files, ex."cccamp07-de-1845-Freifunk_und_Recht.m4v" but its a folder.
View 4 Replies
View Related
Sep 1, 2010
I have a mytext file with month and year as two separate fields. likemytext fil
08 2010
09 2010
10 2010
........
........
........
I want to read the values of each field i.e., month and year into an awk script.
View 10 Replies
View Related
Sep 21, 2010
If I am logged in as root in a linux system and I run command rm -rf on / folder, should it remove all the files? also the kernel?
View 4 Replies
View Related
Jul 9, 2010
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.
[code]...
View 1 Replies
View Related
Sep 25, 2010
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)
View 2 Replies
View Related
Nov 1, 2010
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 Related
Apr 8, 2011
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?
View 2 Replies
View Related
Apr 9, 2011
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
View 3 Replies
View Related
Mar 8, 2011
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.
View 15 Replies
View Related
Apr 28, 2011
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.
View 14 Replies
View Related
Jun 17, 2010
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.
View 3 Replies
View Related
May 30, 2010
how to delete only files which have no extensions in the directories. but other files should exist.
View 12 Replies
View Related
Feb 10, 2011
What should do? Or how to delete that I have 2 hidden in my PC?
I know nothing that's why please tell me detail if some one know about it?
View 5 Replies
View Related
Feb 10, 2010
Assumed I have the following files:
test12.txt
test13.txt
test14.txt
test15.txt
I want to delete the first 3 files with one command. How to do that?
View 8 Replies
View Related
Apr 14, 2010
i am trying to delete temp files using rm -rf but i am getting this error "bash: /usr/bin/rm: Arg list too long"
View 11 Replies
View Related
Nov 11, 2010
Is this possible someone delete one file or folder in linux server its automatically stored one path like recyclebin.
View 5 Replies
View Related
Feb 22, 2010
How can I remove all .swp files in all of my subdirectories under Linux?
View 4 Replies
View Related
Jul 23, 2010
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?
View 3 Replies
View Related
Sep 24, 2010
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 Related
Mar 16, 2010
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
View 2 Replies
View Related
Mar 23, 2011
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:
peindom1.php
peindom2.php
peindom3.php
peindom4.php
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
View 14 Replies
View Related
Jan 6, 2011
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?
View 10 Replies
View Related
Sep 18, 2009
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?
View 3 Replies
View Related
Apr 6, 2010
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
View 4 Replies
View Related
Mar 17, 2010
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?
View 8 Replies
View Related