LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Ho to move selected files to another directory

Solved!
Go to solution

Hello,

how can i move files to another directory.

For example i want to move *.txt from c:\1 to d:\2.

 

So i want to set the type in the vi and move all to the other directory.

 

And: Is it possible to set instead of *.txt something like *.t* so that all *.txt and *.t01, t02, tab and so on are moved?

 

Thanks for your help

0 Kudos
Message 1 of 16
(6,207 Views)

You can use something like this. If you use folder as the input for your start path it will copy the whole folder to the new directory.

 

 Move FIles.png

Tim
GHSP
0 Kudos
Message 2 of 16
(6,205 Views)
Yes, i know how to move a whole folder but i want only specific files, not all files to be moved.
0 Kudos
Message 3 of 16
(6,196 Views)
Are you trying to do this programmaticly? I am not sure what you are trying to accomplish here. If you are try to move only selected files then you will have to make an interface that allows you to select those file. We have done this in the past using an array and having the user select the file by highlighting them like in a windows file dialogue.
Tim
GHSP
0 Kudos
Message 4 of 16
(6,192 Views)

move file by pattern.png

 

Here's a sample.  Recursive file list is the star of the show.  when you say you want to move "specific files" that should get you thinking "I need to move them one at a time, so I need a loop."  Then you need a list of the files.  Recursive file list gives you a list of the files by pattern, and then you just trim off the beginning of the path and build in the new path beginning.

 

I recommend going through the "file I/O" palette with context help (ctrl+h) on and reading the description of all of the VIs there.  If you want to prompt for the paths, use File Dialog, found in the advanced subpalette

 

-b

Message Edited by blawson on 10-20-2009 10:05 AM
-Barrett
CLD
Message 5 of 16
(6,189 Views)

Where can i find the "execute dos-command" in labview? I can do it with a simple command "move *.d* "c:\2"

But currently i cant find the vi to do this.

0 Kudos
Message 6 of 16
(6,188 Views)

All of the file vis are on the file pallet.

 

File Stuff.png

 

 

Tim
GHSP
0 Kudos
Message 7 of 16
(6,178 Views)

OnlyOne wrote:

Where can i find the "execute dos-command" in labview? I can do it with a simple command "move *.d* "c:\2"

But currently i cant find the vi to do this.


 

Do you mean System Exec? 

 

 

 

Such as is described in this thread?

http://forums.ni.com/ni/board/message?board.id=170&message.id=163151

Message Edited by Ray.R on 10-20-2009 11:22 AM
Message 8 of 16
(6,174 Views)

Ahh, yes this is what i was searching for.

But its not working as it should... I have no error and no return-code but the files are not moved.

When i run the attached examples then nothing happens to the file in c:\1

When i copy the command and execute it in a cmd-box then i runs

0 Kudos
Message 9 of 16
(6,165 Views)

OnlyOne wrote:

Ahh, yes this is what i was searching for.

But its not working as it should... I have no error and no return-code but the files are not moved.

When i run the attached examples then nothing happens to the file in c:\1

When i copy the command and execute it in a cmd-box then i runs


Why don't you use the example that blason posted? His soultion is much better than going to the command line to do this. It would also be easy to add filters to the code to allow you to move only certain files. By using his example you will be able to get status for all of the files moved.



Mark Yedinak
Certified LabVIEW Architect
LabVIEW Champion

"Does anyone know where the love of God goes when the waves turn the minutes to hours?"
Wreck of the Edmund Fitzgerald - Gordon Lightfoot
Message 10 of 16
(6,161 Views)