anatta anatta wrote:
> Here is my working code - to copy files from one drive to another.
>
> I however want to copy selective files.
>
> For example I like to copy only .txt files only from the source to
> destination, and not other types of files.
>
> How could I do this selective copying?
S
On 12/05/2016 08:20 AM, anatta anatta wrote:
Dear tutor!
Here is my working code - to copy files from one drive to another.
I however want to copy selective files.
For example I like to copy only .txt files only from the source to destination,
and not other types of files.
How could I do t
On 05/12/16 16:20, anatta anatta wrote:
> I however want to copy selective files.
> For example I like to copy only .txt files only
> How could I do this selective copying?
By applying an if test just before you copy
filetype = '.txt' # or read it as an input
...
if sourcefile extension =
Dear tutor!
Here is my working code - to copy files from one drive to another.
I however want to copy selective files.
For example I like to copy only .txt files only from the source to destination,
and not other types of files.
How could I do this selective copying?
Thanks in advance for t
Nelson Kusuma wrote:
> Hello
>
> I have a problem when copy files and directory tree in
> ftp, scripts in here only copy one file:
To transfer an entire directory with ftplib you will have to read the
local directory with os.listdir() and loop to send the files.
There are a few higher-level mod
Hello
I have a problem when copy files and directory tree in
ftp, scripts in here only copy one file:
from ftplib import FTP
rootList = []
session = FTP()
session.connect('workstation', port=21)
session.login(user='saiki', passwd='saiki')
session.retrlines('LIST', rootList.append)
f=open('D:/PARAM
Alan,Thanks for that. I had the wrong file names, now it works, in case anyone is interested here is the code. I use it because at work I need to change different versions of sqlnet.ora :-def compare_files(file_name1, file_name2): x = filecmp.cmp (file_name1, file_name2) print
> The only problem is that despite the fact that as the same user,
> I can manually change these files (so I must have the right file
> permissions ?)
Can you do it from within python at the >>> prompt
Use os.getcwd() to find out where you are
Use os.chdir() to navigate
Use os.listdir() to li
Alan,Thanks for that. Hopefully this now is easier to read. The only problem is that despite the fact that as the same user, I can manually change these files (so I must have the right file permissions ?) - the copying does not happening.def compare_files(file_name1, file_name2):
David,
Can I suggest you rethink your variable names?
That might make it clearer what is happening.
> def compare_files(file_name1, file_name2):
> x = cmp (file_name1, file_name2)
> return x
Seems fair enough except file_name1 and file_name2 are actually file
*contents*!
And in fact
I wrote a small program that compares files test1 and test2 to test3. If the files are different then it copies either test1 to test3 or the reverse.The problem is that the although the shutil.copy2 in thefunction change_files works without error it does not copy. Can anyone see what is
11 matches
Mail list logo