473,626 Members | 3,289 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

deleting system files

56 New Member
hi,

im new to python programming..
im having a difficulty on how to delete a system files and read-only files..

pls help me...

thanks
Jul 11 '07 #1
8 1840
bartonc
6,596 Recognized Expert Expert
hi,

im new to python programming..
im having a difficulty on how to delete a system files and read-only files..

pls help me...

thanks
Sounds like something that you don't want to do, but if you provide specifics you may get some guidance.
Jul 11 '07 #2
heiro
56 New Member
Sounds like something that you don't want to do, but if you provide specifics you may get some guidance.



It is noticeable that most of the virus in removable drives creates a "autorun.in f" w/c is a system file and a xxx.exe(virus file) w/c its attribute is also hidden/read only.when using os.remove(path) i get an error message w/c states "Permission Denied".I think it is because".inf" is a system file and read-only file.
Jul 12 '07 #3
Motoma
3,237 Recognized Expert Specialist
It is noticeable that most of the virus in removable drives creates a "autorun.in f" w/c is a system file and a xxx.exe(virus file) w/c its attribute is also hidden/read only.when using os.remove(path) i get an error message w/c states "Permission Denied".I think it is because".inf" is a system file and read-only file.
Another likely possibility is that the user account you are running as does not have the permission to delete the file.
Jul 12 '07 #4
bartonc
6,596 Recognized Expert Expert
It is noticeable that most of the virus in removable drives creates a "autorun.in f" w/c is a system file and a xxx.exe(virus file) w/c its attribute is also hidden/read only.when using os.remove(path) i get an error message w/c states "Permission Denied".I think it is because".inf" is a system file and read-only file.
Files that are opened (currently being used) by another application will give this error. .inf files are really just text files.
Jul 12 '07 #5
heiro
56 New Member
Files that are opened (currently being used) by another application will give this error. .inf files are really just text files.
ahh ok i got it..but how about read-only files is there any ways how to change it's attributes?..th anks for the prompt reply
Jul 12 '07 #6
heiro
56 New Member
Another likely possibility is that the user account you are running as does not have the permission to delete the file.

im using the administrator account but it still it prompt me the error...
Jul 12 '07 #7
bartonc
6,596 Recognized Expert Expert
ahh ok i got it..but how about read-only files is there any ways how to change it's attributes?..th anks for the prompt reply
From the os module docs:
chmod( path, mode)

Change the mode of path to the numeric mode. mode may take one of the following values (as defined in the stat module) or bitwise or-ed combinations of them:
S_ISUID
S_ISGID
S_ENFMT
S_ISVTX
S_IREAD
S_IWRITE
S_IEXEC
S_IRWXU
S_IRUSR
S_IWUSR
S_IXUSR
S_IRWXG
S_IRGRP
S_IWGRP
S_IXGRP
S_IRWXO
S_IROTH
S_IWOTH
S_IXOTH
Availability: Macintosh, Unix, Windows.
Jul 12 '07 #8
heiro
56 New Member
From the os module docs:

thanks a lot....i will try using it.....i'll just post again if i will encounter problems
Jul 12 '07 #9

Sign in to post your reply or Sign up for a free account.

Similar topics

5
16768
by: Rosa | last post by:
Hi, I'm trying to clear the TIF on Windows XP programmatically with the below code. This code works fine on any folder but the TIF. For some reason the atEnd() statements always defaults to true and no files are deleted in the folder. The peculiarity of this issue is that the files/subfolders cannot be seen through the windows explorer either. I can only access/delete them through a command shell. Any ideas?
5
4016
by: Olaf Gschweng | last post by:
We're new into DB2 and have some problem with DB2 8.1 (?) on a Linux system. We load some big tables of a DB2 database from files every day. We do a "DELETE FROM table" for each table and then we load the data by something like that: LOAD FROM "/pathto/artikel.data" OF DEL MODIFIED BY DATESISO CHARDEL0xbf SAVECOUNT 50000 MESSAGES "/pathto/artikel.msg" INSERT INTO artikel;
3
2989
by: kris.dorey | last post by:
Hi, Ive got the following code which seems ok but when the user runs the function for a second time I get an error message stating that the mdb is in use by another process. There is still an ldb for the life of the application even after calling oldebconnection.close and gc.collect. Any ideas?
6
4554
by: Martin Bischoff | last post by:
Hi, I'm creating temporary directories in my web app (e.g. ~/data/temp/temp123) to allow users to upload files. When I later delete these directories (from the code behind), the application restarts and all active sessions are terminated. This error is also described in detail here:...
8
14020
by: shandra | last post by:
I have a file I need to delete or truncate. I tried using the KILL command in VB6. I tried using the file.delete command in VB.net. I tried manually deleting, renaming, and copying over the file... but nothing works. I keep getting the error: Cannot delete access_log: it is being used by another person or program. I tried shutting down services, I tried killing processes using the task manager, I tried rebooting, and still, I get...
3
1568
by: Martin Ho | last post by:
Can someone help me with this please? I wasn't very clear in my old post. I have a program to copy files from one location to another, now I want to copy only those files which were created on certain date. How do I compare the file (date created) to system date? Something like this doesn't work: if System.IO.File.GetCreationTime(path to my file) = date.Now then copy ....
2
2535
by: Josh Kandiko | last post by:
Hi, I've been having some frustrations with deleting files from the Isolated Storage directories. Basically, I want my application to remove all instances of configuration information for my application when the application is uninstalled. So, I created an uninstaller class that overrides the uninstall method, as follows: private void DeleteSettings(){ // Try and delete the settings.config
5
2098
by: Sandeep Singh Sekhon | last post by:
I am Developing a Web Application with ASP.NET 1.1 I have one project Folder which is virtual directory of IIS. In this directory, I have one Folder named Photos in which I used to Store Photos. On my Web Page, I have a button named delete which I used to delete photo in the folder. But when I click the button and apply the logic to delete the file, it raises an Exception that the access to the file is denied. I am using following code to...
3
2869
by: Kimera.Kimera | last post by:
I'm trying to write a program in VB.net 2003 that basically deletes all files, folders, sub-folders and sub-sub folders (etc). The program is simply for deleting the Windows/Temp folder contents, removing all the files/folders inside it. The problem i am having is that i can only delete files in the Windows/Temp folder, and i can't delete folders if they contain files, i know that you can't do this.
12
2435
Nepomuk
by: Nepomuk | last post by:
Hi! I want to have my program delete some folders including all contents. For that, I wrote this method: private static void delete(String source) { File tmp = new File(source); if(tmp.isDirectory() && tmp.list().length > 0) { System.out.print("** Directory: " + tmp.getName()); String list = tmp.list();
0
8272
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8205
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8713
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8644
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8514
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
4094
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4208
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2632
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1817
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.