ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Move a file without opening it. (https://www.excelbanter.com/excel-programming/294101-move-file-without-opening.html)

David Seebaran

Move a file without opening it.
 
Hi all,

Hope someone can help.

Is it possible to move a file from one sub-directory to another without
opening it.

The problem is that my program is relying on only opening '.xls' files of a
specific filename convention. Therefore, if someone has put a file in the
sub-directory that is not what I am looking for, I want to move it. At the
moment I just 'Kill' the erroneous file but that is not very friendly, on
the other hand, I don't want to 'Open' it, 'Save' it to a new location and
then 'Kill' it in it's original location.

Regards,


David Seebaran.

E-mail:



Chip Pearson

Move a file without opening it.
 
David,

Assuming that both directories exist, you can use the Name statement to move
the file from one directory to the other. E.g,

Name "C:\Test\Test.txt" As "C:\Test2\Test.txt"


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com



"David Seebaran" wrote in message
...
Hi all,

Hope someone can help.

Is it possible to move a file from one sub-directory to another without
opening it.

The problem is that my program is relying on only opening '.xls' files of

a
specific filename convention. Therefore, if someone has put a file in the
sub-directory that is not what I am looking for, I want to move it. At

the
moment I just 'Kill' the erroneous file but that is not very friendly, on
the other hand, I don't want to 'Open' it, 'Save' it to a new location and
then 'Kill' it in it's original location.

Regards,


David Seebaran.

E-mail:





David Seebaran

Move a file without opening it.
 
Hi Chip,

Thank you very much, it works perfectly.

Regards,


David Seebaran.

E-mail:

"Chip Pearson" wrote in message
...
David,

Assuming that both directories exist, you can use the Name statement to

move
the file from one directory to the other. E.g,

Name "C:\Test\Test.txt" As "C:\Test2\Test.txt"


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com



"David Seebaran" wrote in message
...
Hi all,

Hope someone can help.

Is it possible to move a file from one sub-directory to another without
opening it.

The problem is that my program is relying on only opening '.xls' files

of
a
specific filename convention. Therefore, if someone has put a file in

the
sub-directory that is not what I am looking for, I want to move it. At

the
moment I just 'Kill' the erroneous file but that is not very friendly,

on
the other hand, I don't want to 'Open' it, 'Save' it to a new location

and
then 'Kill' it in it's original location.

Regards,


David Seebaran.

E-mail:








All times are GMT +1. The time now is 09:34 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com