move files to specific directory

English support forum

Moderators: white, Hacker, petermad, Stefan2

Post Reply
Valman
Junior Member
Junior Member
Posts: 60
Joined: 2003-09-12, 12:43 UTC

move files to specific directory

Post by *Valman »

I have read a post a long time ago with the solution of this problem but now I can't find it via search :evil:

All I want to do is assign a keyboard shortcut to a macro that would move all selected items of the active panel to a predefined directory (e.g C:\aatemp)

I don't want any verification window or overwrite warning. I only want once the shortcut is pressed, all selected items to be moved to that folder.

Any idea?
Valman
Junior Member
Junior Member
Posts: 60
Joined: 2003-09-12, 12:43 UTC

Post by *Valman »

found it

topic can be closed

http://ghisler.ch/board/viewtopic.php?t=464
User avatar
Sheepdog
Power Member
Power Member
Posts: 5150
Joined: 2003-12-18, 21:44 UTC
Location: Berlin, Germany
Contact:

Post by *Sheepdog »

Solution:

a batch (movv.bat):

Code: Select all

for /f "delims=" %%a in (%1) do echo move /y "%%a" C:\aatemp
placed in the path (e.g %windir%)

and a button

command: %comspec% /c movv.bat
Parameter: %L

should work. But just test, because move /y moves - as desired - without confirmation.

I does not move hidden or system files. That would require another line in the batch to clear those flags for the files.

sheepdog
"A common mistake that people make when trying to design something
completely foolproof is to underestimate the ingenuity of complete fools."
Douglas Adams
Valman
Junior Member
Junior Member
Posts: 60
Joined: 2003-09-12, 12:43 UTC

Post by *Valman »

Thanks for the answer.

Dont close the topic cause I can't make it work on XP!:O


I used the solution suggested in the topic:http://ghisler.ch/board/viewtopic.php?t=464


Command: cmd /c
Parameters:
for /f "delims=" %%f in (%L) do move "%%f" "e:\__aatemp"

It does not work:O

I am trying your solution now:[
Valman
Junior Member
Junior Member
Posts: 60
Joined: 2003-09-12, 12:43 UTC

Post by *Valman »

grrrrrr

movv.bat: (in windows dir)

Code: Select all

for /f "delims=" %%a in (%1) do move /y "%%a" E:\
pause
Custom menu entry:

command:

Code: Select all

%comspec% /c movv.bat 
parameters

Code: Select all

%L 
The error I get is:

Code: Select all

> for /F "delims=" %a in (C:\Documents) do move /y "%a" E:\
The system cannot find the file C:\Documents.

> pause
Press any key to continue . . .
Where does the "C:\Documents" comes from???

There is no panel that targets "C:\Documents" and in fact there is no folder named "C:\Documents". Of course there is the folder "Documents and Settings" which btw I never use.

I am not working in C drive either :O


I am missing something here :evil: :evil: :evil:
User avatar
Hacker
Moderator
Moderator
Posts: 13073
Joined: 2003-02-06, 14:56 UTC
Location: Bratislava, Slovakia

Post by *Hacker »

Try "%L" instead of %L in Parameters.

HTH
Roman
Mal angenommen, du drückst Strg+F, wählst die FTP-Verbindung (mit gespeichertem Passwort), klickst aber nicht auf Verbinden, sondern fällst tot um.
Valman
Junior Member
Junior Member
Posts: 60
Joined: 2003-09-12, 12:43 UTC

Post by *Valman »

Thanks hacker..

I had to add the usebackq option too so no batch file is needed in %windir%.

Fixed as follows (demo code, menu entry):

Code: Select all

cmd /k
for /F "usebackq" %%a in ("%L") do echo move %%a S:\target\folder && pause
The problem is that this code does not work with folders because TC addes a backslash at the end of the folder name but move command does not accept such syntax.

Any idea appreciated:O
User avatar
XPEHOPE3KA
Power Member
Power Member
Posts: 854
Joined: 2006-03-03, 18:23 UTC
Location: Saint-Petersburg, Russia

Post by *XPEHOPE3KA »

Use list2str. It can remove that slash.
F6, Enter, Tab, F6, Enter, Tab, F6, Enter, Tab... - I like to move IT, move IT!..
User avatar
Sheepdog
Power Member
Power Member
Posts: 5150
Joined: 2003-12-18, 21:44 UTC
Location: Berlin, Germany
Contact:

Post by *Sheepdog »

The problem is that your temp-directory has at least one space in it's name (what mine hasn't - thus this problem did not occur herel).

So you'll have to ask the Operating System polite to consider converting the given path to the temp file to a short name. That can be done with inserting "~s" in the right place. ;)

Just try please:
for /f "delims=" %%a in (%~s1) do move /y "%%a" "E:\target dir"
sheepdog
"A common mistake that people make when trying to design something
completely foolproof is to underestimate the ingenuity of complete fools."
Douglas Adams
Valman
Junior Member
Junior Member
Posts: 60
Joined: 2003-09-12, 12:43 UTC

Post by *Valman »

Sheepdog, I solved that by adding quotes to %L as Hacker suggested. It works fine as far as folders are not selected. If I use short names, folders will still be a problem right?

As far as I can understand, the only solution for folders is to use lst2str but I do not want to add dependencies on external programs. I generally avoid using any kind of plugin unless absolutely necessary.

The ideal solution would be a cm_RenMov command that would support a parameter as a "default target directory" eg:

Code: Select all

Command: cmRenMov
Parameters: E\__aatemp
That would be nice as the use of move would be avoided and I wouldn't have to face problems that might occur in case of hidden or system files.
Post Reply