Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place. |
Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
 |
08-12-2014, 08:15 AM
|
#1
|
LQ Newbie
Registered: May 2012
Posts: 21
Rep: 
|
delete a html file along with its associated folder
hi,
i have a huge folder with lots of webpages saved as with the "webpage complete" option.
As of now when i delete a particular saved webpage, i find that the webpage is deleted but its associated folder in which the various images,scripts,etc are stored is left over as a residue. Thus today in that folder, i have residual folders of webpages whose html file has been deleted by me.
As a result the folder is cluttered with lots of those residual folders of html files which are no longer present.
The only option currently which i do is boot into windows where i copy that main folder.Cut-copy-paste the remaining html files to some other folder.
***
Now under windows when you delete a html file saved with the "webpage complete" option, upon deletion both the head and tail gets deleted. Whereas in linux the head goes but the tail remains.
***
This finally leaves me with the orphaned folders of those webpages whose html files i have deleted.
Then i delete those folders/the main folder itself.
Copy back the remaining html files folder back into linux.
Now i want to ask , is there any way to accomplish the same cleanly in linux ?
Currently in linux, i have to first click the html file and then search above for the corresponding folder and then del both.
For one or two webpages it is fine, but when lots of webpages are saved, i am forced to resort to the previous process to avoid tediousness & keep the folder clean.
regards
|
|
|
08-12-2014, 08:29 AM
|
#2
|
Moderator
Registered: Mar 2011
Location: USA
Distribution: MINT Debian, Angstrom, SUSE, Ubuntu, Debian
Posts: 9,939
|
I don't believe so. I have seen the same behavior where you delete the top HTML file under Windows and it gets rid of the associated sub-folder. I don't like that behavior and so when Linux does not behave this way, I'm fine. On the other hand, I've never seen it be more than one folder at the top level; i.e. if you save a web page complete as <blah-blah>.HTML then it will make a sub-folder titled "<blah-blah>_files" and if there were a lengthy hierarchy under that, so be it. My point there is that you delete the HTML file and the one extra step would be that you'd have to delete the associated similarly named sub-directory.
|
|
|
08-16-2014, 05:32 AM
|
#3
|
LQ Newbie
Registered: May 2012
Posts: 21
Original Poster
Rep: 
|
well , what you have written i have already covered in my post.
i am asking an answer and if there is one i would definitely like to hear.
On my part i know that since everything is a file in linux, when you delete the html file the html file only goes, for the corresponding folder will be treated as another file, even though technically it is associated with that html file and thus it is left as a residue in layman's words. The same is recognized in windows and taken care of and just like "dependency" in package mgt in linux so is "association" in html files, which is nothing but a intelligent aspect there in windows. Maybe this may be missing in linux.
Nevertheless , i put the query so as to get an idea, if there is anything further way to get the same done, and which i am not knowing and missing in my knowledge.
Last edited by beopen; 08-16-2014 at 05:57 AM.
|
|
|
08-16-2014, 07:08 AM
|
#4
|
Moderator
Registered: May 2001
Posts: 29,415
|
Quote:
Originally Posted by beopen
(..) the corresponding folder will be treated as another file, even though technically it is associated with that html file
|
No, that is an interpretation. From a file system point of view the name the file is saved as and the directory holding the related files strictly speaking aren't even the same: both Firefox and Opera will tack "_files" onto the directory name. Cleaning up could look something like this:
Code:
find /some/path/ -maxdepth 1 -type d -iname \*_files | while read ITEM; do [ -f "${ITEM//_files/}.html" ] || echo "rm -rf ${ITEM}"; done
Quote:
Originally Posted by beopen
The same is recognized in windows
|
Simply put Windows does not equal Linux.
|
|
|
08-17-2014, 01:43 PM
|
#5
|
LQ Newbie
Registered: May 2012
Posts: 21
Original Poster
Rep: 
|
yeah you are right on that. i just missed that "_files" to the directory. Just saw after your post. All directories are having the "_files" appended to the name. Though on a gross look it seems they must be having the same names.
But that command which you have put is too much for me. I am not that a big advanced user in linux of that depth.
So i guess i go the simpler manual way which i am right now doing by going to windows and deleting such huge folders, for it is getting my work done.
The problem occurs only when i save a lot of webpages and dont attend to them immediately. One or two is not a problem. May be i may have to alter my work method then.
thanks for your replies
|
|
|
All times are GMT -5. The time now is 12:35 PM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|