?
Solved

Syntax Issue

Posted on 2012-03-26
14
Medium Priority
?
267 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 56

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 800 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
Four New Appliances. Same Industry-leading Speeds.

But don't take it from us.  The Firebox M370 is Miercom tested and Miercom approved, outperforming its competitors for stateless and stateful traffic throughput scenarios.  Learn more about the M370, M470, M570 and M670 and find the right solution for your organization today!

 
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 800 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 56

Accepted Solution

by:
Bill Prew earned 1200 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 56

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

Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

Question has a verified solution.

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

In this blog, we’ll look at how improvements to Percona XtraDB Cluster improved IST performance.
This month, Experts Exchange’s free Course of the Month is focused on CompTIA IT Fundamentals.
If you're a developer or IT admin, you’re probably tasked with managing multiple websites, servers, applications, and levels of security on a daily basis. While this can be extremely time consuming, it can also be frustrating when systems aren't wor…
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…
Suggested Courses

770 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