Solved

Syntax Issue

Posted on 2012-03-26
14
262 Views
Last Modified: 2012-03-28
Hi All,

Have a problem with a client. Need to upload documents to Sharepoint / Office 365 but getting an error and its down to a filenaming issue.

My client for the last 6 year has been adding a "." a the end of file he saves

So the net result is a file that looks like below when file ext is visable

Accounts..xls
bills..xls

About two thousand of these in various folders and subfolders in my docs,

is there a program that can be run to remove the "."

all help appreciated

Regards

Noel
0
Comment
Question by:PC_Mechanic
  • 4
  • 3
  • 3
  • +2
14 Comments
 
LVL 53

Expert Comment

by:Bill Prew
ID: 37768584
I'm on a mobile device right now so can't test, but have you tried

Ren *..xls *.xls

Try it on a test folder with a couple of the sample files in it to be renamed and see how it goes.

~bp
0
 
LVL 43

Expert Comment

by:Steve Knight
ID: 37768938
Hmm, I don't think that will Bill, at least it didn't for me?

Try this as a batch file "fixfiles.cmd" or similar.... on a test / copy of the dirs of course.  It will run down all the subdirs showing you what it will do.  if it looks good then remove the word REM

Steve

@echo off
setlocal enabledelayedexpansion
cd /d c:\thedirectory

for /r %%a in (*..*) do (
  set name=%%~na
  set name=!name:~0,-1!
  REM rename "%%a" "!name!%%~xa"
  echo Renaming %%a to "!name!%%~xa"
)
0
 
LVL 11

Assisted Solution

by:paultomasi
paultomasi earned 200 total points
ID: 37768968
Here you go:

NOTE: Change line 4 to point to your starting folder.
@echo off
setlocal enabledelayedexpansion

set folder=c:\

for /r  "%folder%" %%a in (*..*) do (
  set fn=%%~na
  set fn=!fn:~0,-1!
  ren "%%~fa" "!fn!%%~xa"
)

Open in new window

0
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 
LVL 43

Expert Comment

by:Steve Knight
ID: 37768983
Paul, that's the same as mine!
0
 
LVL 11

Assisted Solution

by:paultomasi
paultomasi earned 200 total points
ID: 37769004
Wow! Steve, our codes are almost identical! Shows it's the RIGHT way to do this.

Here's an optional way:
@echo off
setlocal enabledelayedexpansion

set folder=c:\

for /r  "%folder%" %%a in (*) do (
  set fn=%%~na
  ren "%%~fa" "!fn:..=.!%%~xa"
)

Open in new window

NOTE: This one has the advantage of renaming any filename containing '..'
0
 
LVL 43

Expert Comment

by:Steve Knight
ID: 37769013
True Paul, I decided against doing the replace .. with . in case there were other .. or more dots within the name but frankly doesn't really matter a lot either way if a dot is lost I guess.

Steve
0
 
LVL 11

Expert Comment

by:paultomasi
ID: 37769018
Hahaha... Seems like we are cross-posting!
0
 
LVL 53

Accepted Solution

by:
Bill Prew earned 300 total points
ID: 37769652
Rereading the original post, it sounds like a script wasn't a requirement, just a "program".  To that end, here are several rename utilities that are free that I have looked at for things like this that you could check out to see if you like their approach better.

http://www.bulkrenameutility.co.uk/Main_Intro.php
http://file-folder-ren.sourceforge.net/index.php?page=Main
http://www.den4b.com/?x=products&product=renamer
http://rename.lupasfreeware.org/
http://www.advancedrenamer.com/

~bp
0
 
LVL 10

Expert Comment

by:ReneGe
ID: 37769666
Guys, it was fun reading your comments.  After a long absence (which I'm not completely back), I feel like Dartanian having a beer with his fellow Musketeers.

Please forgive my intrusion but for what it's worth, I would vote for Steve and Paul's first (almost at the same time) posts.

Adding to the FWIW, I have users naming file names with strange chars combinations, including ".."

So by replacing ".." by ".", may be a challange if the users had shortcuts on there desktops or they would be referenced somehow (backup software, Sharepoint...) with "..".

For example "Accounting..Finance..Employees..Office Supplies.xls".

Well I dont know Sharepoint, so your are the best juge on this.

Just adding my possible extra cheese, to the pizza!!

Cheers,
Rene
0
 
LVL 10

Expert Comment

by:ReneGe
ID: 37769678
@Bill

You have a point. However, the poster put MS DOS as the primary Topic.

I will look at your renaming utilities, I will surely find an interesting tool.

We still did not get any feedback from the poster.

Cheers,
Rene
0
 

Author Comment

by:PC_Mechanic
ID: 37779122
Wow,

Didn't think id get so much feedback from the question. Will test and report back, I was off for a few days.

Thanks,

Noel
0
 

Author Closing Comment

by:PC_Mechanic
ID: 37779351
The Advance renamer program worked a treat

So ill award the most points to BP as the "program" made it so easy

also 100 points each to Paul and Steve for technical genius

Regards,

Noel
0
 
LVL 53

Expert Comment

by:Bill Prew
ID: 37779371
Thanks, glad that helped.

~bp
0
 
LVL 11

Expert Comment

by:paultomasi
ID: 37780257
Thank you
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Are you one of those front-line IT Service Desk staff fielding calls, replying to emails, all-the-while working to resolve end-user technological nightmares? I am! That's why I have put together this brief overview of tools and techniques I use in o…
Email signature management is something that is often overlooked in many organizations or is simply not implemented effectively. Let's take a look at what methods are available for managing this important piece of corporate branding.
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

832 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question