Solved

Syntax Issue

Posted on 2012-03-26
14
264 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
  • 3
  • +2
14 Comments
 
LVL 54

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
Edgartown IT Case Study

Learn about Edgartown's quest to ensure the safety and security of the entire town's employee and citizen data. Read the case study!

 
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 54

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 54

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

PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

Question has a verified solution.

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

Ever wondered why Windows 8 and 10 don't seem to accept your GPO-based software deployment while Windows 7 does? Read on.
Scenario: Your operations manager has discovered an anomaly in your security system. The business will start to suffer within 15 minutes if it is a major IT incident. What should she do? We have 6 recommendations for managing major incidents (https:…
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

737 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