Results 1 to 4 of 4

Thread: Script to automate batch file moving and renaming

  1. #1
    Doh! braheem24's Avatar
    Join Date
    Feb 2001
    Location
    KOCF & 89ft ASL
    Occupation
    Other Eyecare-Related Field
    Posts
    3,829

    Script to automate batch file moving and renaming

    Alright, I don't usually post my IT questions on this forum but I'm hoping this could be a system I could share with other independents to digitally archive all our info and help them look a little less like a mom and pop shop. I also have an easy to print price tags for frames and sales receipts that come out of a printer instead of hand a written one a plumber would give you...and all without having to buy any bloatware/software.

    MY NEED:

    I have a folder on a shared network drive with excel and pdf files; they're both in the format of LastName_FirstName_PhoneNumber.xls and LastName_FirstName_PhoneNumber.pdf

    I'm trying to automate it where a script can make a folder using all of the excel sheet names and put all the files into that folder everytime something is dropped into the folder.

    for example, I have patient files
    Smith_Bob_800-555-1212.XLS
    Smith_Bob_800-555-1212.PDF

    The script would create a folder named Smith_Bob_800-555-1212 and place both the pDF and XLS into that folder.

    TIA

  2. #2
    OptiBoard Apprentice
    Join Date
    Apr 2008
    Location
    Fresno
    Occupation
    Optical Laboratory Technician
    Posts
    30
    Modified from this post http://stackoverflow.com/questions/1...to-that-folder Change your sourcedir and run like this to make sure what it's planning on doing is right. Then remove the ECHO s from the DO section and it should be gravy. Tho getting it to run every time you drop a file in there. Not to sure.

    @ECHO OFF
    SET "sourcedir=c:\sourcedir"
    PUSHD %sourcedir%
    FOR /f "tokens=1* delims=." %%a IN (
    'dir /b /a-d "*_*_*-*-*.*"'
    ) DO (
    ECHO MD %%a
    ECHO MOVE "%%a.%%b" .\%%a\
    )
    POPD
    GOTO :EOF

  3. #3
    Doh! braheem24's Avatar
    Join Date
    Feb 2001
    Location
    KOCF & 89ft ASL
    Occupation
    Other Eyecare-Related Field
    Posts
    3,829
    Thank you, I got it fixed. Amazingly In found that same ophthalmic post question you linked.

  4. #4
    OptiBoard Apprentice
    Join Date
    Apr 2008
    Location
    Fresno
    Occupation
    Optical Laboratory Technician
    Posts
    30
    Yeah, it has been a looooong time since I've written any batch files. I took a graveyard bound machine, turned it into a linux box, remote in and either write in bash or python everything I need done now.

    Glad to hear you got it.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Double vision with myopic script
    By thelaz in forum General Optics and Eyecare Discussion Forum
    Replies: 10
    Last Post: 09-06-2010, 09:32 PM
  2. script, rimless and other
    By smiladon in forum Just Conversation
    Replies: 9
    Last Post: 06-07-2009, 07:37 AM
  3. Can I wear rimless with this script?
    By deadmuse in forum Just Conversation
    Replies: 2
    Last Post: 02-19-2009, 01:13 PM
  4. Script for explaining charges for exam
    By Ladyoptician in forum General Optics and Eyecare Discussion Forum
    Replies: 4
    Last Post: 12-15-2006, 10:20 PM
  5. What does a good RX script include?
    By PAkev in forum General Optics and Eyecare Discussion Forum
    Replies: 10
    Last Post: 02-17-2004, 12:43 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
OptiBoard is proudly sponsored by:
Younger Optics and Vision Equipment