473,473 Members | 1,824 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Move all files to a new folder, and delete files in original folder

547 Contributor
I have files in the following folder with a ".out" extention. c:\rt\rfidlogs\.out" and need to move all these ".out" files to c:\rt\rfiderrors\ folder, and then delete the original in the rfidlogs folder
Cannot get it to work
Expand|Select|Wrap|Line Numbers
  1. FileCopy "c:\rt\rfidlogs\*.out", "c:\rt\rfiderrors\"
  2. Close #1
  3.    Kill "C:\RT\rfidlogs\*.out"
Please guide me
Aug 31 '12 #1
4 2228
twinnyfo
3,653 Recognized Expert Moderator Specialist
I believe the best way would be to copy and kill each file individually.
Aug 31 '12 #2
Hennepin
25 New Member
I prefer using the file system object
Expand|Select|Wrap|Line Numbers
  1.     Dim FSO As Object
  2.     Set FSO = CreateObject("scripting.filesystemobject")
  3.     FSO.MoveFile "c:\rt\rfidlogs\*.out", "c:\rt\rfiderrors\"
or with reference set to 'microsft scripting runtime' then IntelliSense will work
Expand|Select|Wrap|Line Numbers
  1.     Dim fs As New FileSystemObject
  2.     fs.MoveFile "c:\rt\rfidlogs\*.out", "c:\rt\rfiderrors\"
Aug 31 '12 #3
zmbd
5,501 Recognized Expert Moderator Expert
yes but why call another library reference?

Expand|Select|Wrap|Line Numbers
  1. Sub testmove()
  2. Name %1 As %2
  3. End Sub
Where %1 is the full name and path to the file of interest
and %2 is the full name and path to the new location.
You can also take the Dir function results to an array and then use the array to feed the code above the old and new names...

(edit: array or a collection... either way... google search will turn up tons of code to handle recursion too)

http://www.applecore99.com/gen/gen061.asp

-z
Aug 31 '12 #4
NeoPa
32,556 Recognized Expert Moderator MVP
Neels, the problem with your code is probably that line #2 hasn't run before you start, but Z's suggestion is a far better approach all round. Set it as Best Answer now is my advice ;-)
Aug 31 '12 #5

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

Similar topics

11
by: Ben | last post by:
Greetings, I am looking for a way to search for and delete files based on a pattern mask. For example, the search method would find all files matching a certain pattern containing wildcards (e.g....
2
by: U C | last post by:
Hi, Can i delete files in cdump folder. Whats the basic use of having files in cdump folder. Is there any need to take backup when deleting the same. I am having solaris if we can delet then what...
5
by: Raj | last post by:
Hi all, Can anyone help me with a script which would delete files or move them to a different folder at some scheduled time..! Please.....!!! Thanks in advance...
3
by: Krazitchek | last post by:
Hi, how do i do to delete files with a specific extension (like *.lnk). I try File.Delete(@"e:\test\\*.lnk) but it does not work, not the good way i guess... Help please, thanks.
1
by: Keith Henderson | last post by:
It seems that I will soon have to write a windows service (or if there's something more appripriate?) that will delete files off of a hard drive. Here's an example, a file will be placed in a...
8
by: hugh | last post by:
Hi there, Is there any way to make a DeleteFileDialog that works similar with OpenFileDialog? Thanks very much. Hugh
0
by: andoband | last post by:
Using VS 2005, I have created a solution and it's projects using the following physical folder structure: d:\projects\Enterprise.root\Enterprise\Enterprise.sln...
0
by: =?Utf-8?B?TWVlbWEgSnVkeQ==?= | last post by:
I have a Verizon Palm Treo 755p and use Outlook 2002 on my new HP Pavilion (Vista 64-bit). When I was syncing on my old XP PC, everything worked fine. On the Vista PC, when I finally got it to...
2
by: bibek24 | last post by:
Hi all, The following problem is occuring for a particular user who doesn't have full permissions to the shared folder. Microsoft Office Access cann't delete the original mdb file after...
1
by: ebrahim abd | last post by:
dear friends, i wrote a job to backup my server but because of my hard disk limittition i want to write another job to compress my bak files and delete files that are older than 20 days . my...
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
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
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
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 ...
0
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.