8
C:\Users\Moondra>move "WebScraping with Python projects.ipynb", Untitled2.ipynb "Scraping projects"

I'm trying to move the first two files ("WebScraping with Python projects.ipynb", Untitled2.ipynb) to the folder "Scraping projects". I can move one file to the folder at a time, but I can't seem to move both via one command.

I keep getting The syntax of the command is incorrect. even if I remove the comma in between the two files.

1

2 Answers 2

5

I can move one file to the folder at a time, but I can't seem to move both

I keep getting The syntax of the command is incorrect. even if I remove the comma in between the two files.

The source must be a single file, a directory, or a wildcard expression. None of these apply in your case, where you are specifying two files.

The syntax of the move command is:

Syntax

MOVE [options] [Source] [Target]

Key

source : The path and filename of the file(s) to move.

target : The path and filename to move file(s) to.

options:
    /Y    Suppress confirmation prompt, when overwriting files.
    /-Y   Enable confirmation prompt, when overwriting files.

Both Source and Target can be either a folder or a single file.

The source can include wildcards (but not the destination).

Source move

Assuming that your source directory contains only the 2 ipynb listed in the question you can use the following command:

move *.ipynb "Scraping projects"

Further Reading

3
  • Thank you for the reply. Unfortunately, I have many .ipynb files in the source directory, so I can use the wildcard method.
    – moondra
    May 21, 2017 at 22:49
  • 2
    @moondra If you can't use wildcards then you will have to use two separate move commands, one for each file.
    – DavidPostill
    May 21, 2017 at 22:52
  • 6
    jun ran move /? and it said To move one or more files: MOVE [/Y | /-Y] [drive:][path]filename1[,...] destination so you can specify multiple files to move, although it didn't work when I tried
    – phuclv
    Apr 14, 2019 at 10:32
1

The MOVE /? text is wrong, or misleading, both in English and German, as of Windows 10 21H2 (10.0.19044.2846). You can only move multiple files by wildcard.

Many people will have Git for Windows or Cygwin installed, and they can make the UNIX mv.exe command available (beware of its pitfalls, though: it overwrites without confirmation) by placing a one-line script called mv.bat in the PATH:

@"C:\Program Files\Git\usr\bin\%~n0.exe" %*

The %0 is the name the script was called with, and %~n0 is the name only without the path and the extension. You can then hardlink other names to that script, and it will call executables in that same folder:

mklink /h diff.bat mv.bat
mklink /h perl.bat mv.bat

Or use a FOR loop and a TXT file containing only the command names to link your two or three dozen in one go:

for /f %A in (git-usr-bin-useful.txt) do @echo %A

Replace echo with the suitable mklink command in the for loop.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .