473,396 Members | 1,891 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

How to get files of a Directory

cpiyush
31
Hi.

I am trying to read all the file names of a directory & trying to use getDir() function.
But its saying AttributeError: 'module' object has no attribute 'getDir'
Can you tell me the correct syntax to use it.

I have one more query: - Plz tell me how to execute any command using python.
i.e. i want to run
sqlplus /nolog @c:\try.sql
Can you tell me how to use it???

Thanks & Regards.
Piyush.
Apr 19 '07 #1
2 3637
ghostdog74
511 Expert 256MB
Hi.

I am trying to read all the file names of a directory & trying to use getDir() function.
But its saying AttributeError: 'module' object has no attribute 'getDir'
Can you tell me the correct syntax to use it.

I have one more query: - Plz tell me how to execute any command using python.
i.e. i want to run
sqlplus /nolog @c:\try.sql
Can you tell me how to use it???

Thanks & Regards.
Piyush.
check the os module.
for getting file names, you can use os.listdir(), or os.walk(). you can also use glob module which supports wildcard '*'. See glob module.
as for how to execute an external command, you can use os.system(), or the newer module called subprocess
Apr 19 '07 #2
cpiyush
31
Thanks man...
Apr 19 '07 #3

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

Similar topics

2
by: Gary Feldman | last post by:
Since I prefer to keep all my installed programs in one place, I went ahead and installed Python in Program Files/Python. The command line shell seems to work just fine, and I'm able to import...
2
by: Amy L. | last post by:
I am working on some code that will be used in a Windows Service that will monitor specific files in a queue. I would like to get an integer value of the amount of specfic files in a directory. ...
2
by: Tim Blizard | last post by:
I know this topic has been discussed before but I couldn't find any thread more recent than about 18 months and was interested in what conclusions people had come to recently. Invariably 3...
3
by: S. Han | last post by:
I'm using Directory.GetFiles to enumerate files in a directory. The problem is if you have to enumerate all files + subdirectories recursively, it takes too much memory, and it fails. Is there...
0
by: JuLiE Dxer | last post by:
Is there a way to programmatically determine if MCE isn't saving the recorded tv video files in the default directory? It'd be nice to know if the saved files aren't in the C:\Documents and...
5
by: Bas Hendriks | last post by:
Has anyone any idea how asp.net find it's files back after compiling them to the temporary asp.net directory? I found on numerous webpages that the directorynames are chosen random but cannot find...
0
by: Don | last post by:
I intermittently get a runtime Compilation Error that says 'The compiler failed with error code 2000'. It appears that a DLL cannot be found in the 'temporary asp.net files' directory. The...
1
by: Shawn Mehaffie | last post by:
I have an application I want to be able to: 1) Store user specifc settings in ther "My Documents". 2) Store some information in "All Users" document directory. 3) I also want to be able to...
23
by: **Developer** | last post by:
Is there an easy way to copies all files in a directory into another directory? What about coping subdirectories too? Thanks in advance for any info
7
by: epikto | last post by:
I have a mapped share that I am trying to get a listing of all the files that it contains. I use the following code to access the contents String files = Directory.GetFiles(path); I can then...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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...
0
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,...
0
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...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
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...

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.