Link to home
Start Free TrialLog in
Avatar of fdenman
fdenman

asked on

Robocopy only files with no extension?

I need to move only files with specified extensions from one drive to another while preserving tree structure.  No problem, I know how to do that with Robocopy.

But I also need to move only files that have no extension.  I can't figure out how to specify files with no extension.  I've tried every combination of include *. and exclude *.*  in the robocopy command line that I can think of, but haven't found a way to copy ONLY files with no extension.

This despite the fact that the command
dir *.
very nicely lists only files without extensions.

I'm trying to reduce the size of a data collection, presently at 600GB and 2.2 million files by moving out file types I don't need to index, because my indexing tool (x1) is grinding to a halt at about 1.2 million files.

If this can't be done with robocopy, I'd appreciate pointers to a utility which can.  I'd also be open to a utility which could rename all files without extensions from *. to *.noext and could do so all the way thru a huge directory tree.  

Thanks!

Frank
Avatar of Wayne Barron
Wayne Barron
Flag of United States of America image

Found this (Untested)
Last post
https://www.computing.net/answers/unix/find-file-with-no-extension/2810.html
=============================
find mydir -type f ! -name "*.*"
=============================
This will find the files (Have not tested it)

If this works, you will just need to find a way to implement it into a move function.
I am not sure if Robocopy can do this.

Carrzkiss
Avatar of fdenman
fdenman

ASKER

This looks like a unix command.  I don't see the -type switch available for the Windows find command.
I cannot seem to find anything on it.
Sorry that I was unable to help more.

Carrzkiss
SOLUTION
Avatar of dbrunton
dbrunton
Flag of New Zealand image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of fdenman

ASKER

I think Drs. Brunton & Wolf have each offered an excellent solution.  I plan to split the points as soon as I can confirm that these work as expected.  I have left Dr Wolf's bat file running overnight on my tree with 2.2 million files.  I'm hoping it will be finished when I wake up.

Does anybody have a feel for the relative speed of ZTree versus Dr Wolf's bat file?

That's hard to say.

Ztree can handle millions of files.  As the website says memory is the only problem.  Dr Wolf's solution can be set to run and walk away.  

With ZTree you'll have to wait until it loads all of the files and that may take time.  On my system it takes about 30 seconds to load 100,000 files.  Your system may differ.  There's a 30 day evaluation version to try out.  Once it's loaded it's easy enough to filter the files and apply.
just give extension name to it.. transfer the file and rename it back to previous one
You can test for files without extensions using %%~x as in the following example (this merely displays the filenames on the screen):

for /f "tokens=*" %%a in ('dir /a-d /b *.*') do (
    if "%%~xa"=="" echo %%~na
)
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
If you want to rename AND move them say, to '.EXT', then you need this:

for /f "tokens=*" %%a in ('dir /a-d /b *.*') do (
    if "%%~xa"=="" (
        ren "%%a" "%%~na.EXT"
        move "%%a.EXT" c:\windows\temp
    )
)


or you can do the whole thing in a single rename/move operation as in:

for /f "tokens=*" %%a in ('dir /a-d /b *.*') do (
    if "%%~xa"=="" (
        move /y "%%a" "c:\windows\temp\%%~na.EXT"
    )
)
Avatar of fdenman

ASKER

I think Drs. Brunton & Wolf have each offered an excellent solution.  I plan to split the points as soon as I can confirm that these work as expected.  I have left Dr Wolf's bat file running overnight on my tree with 2.2 million files.  I'm hoping it will be finished when I wake up.

Does anybody have a feel for the relative speed of ZTree versus Dr Wolf's bat file?

If all you want to do is rename ALL file in the current directory and ALL sub-directories then the following command will do the job.

    for /f "tokens=*" %a in ('dir /a-d /b /s *.*') do @if "%~xa"=="" @ren "%a" "%~na.noext"
dbrunton

Nice to see ZTree get a mention.... I remember playing with XTree version 1.0 (Was written in French) when it first appeared.