[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

Syntax Issue

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

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
Are You Ready for GDPR?

With the GDPR deadline set for May 25, 2018, many organizations are ill-prepared due to uncertainty about the criteria for compliance. According to a recent WatchGuard survey, a staggering 37% of respondents don't even know if their organization needs to comply with GDPR. Do you?

 
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 57

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 57

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

Learn Veeam advantages over legacy backup

Every day, more and more legacy backup customers switch to Veeam. Technologies designed for the client-server era cannot restore any IT service running in the hybrid cloud within seconds. Learn top Veeam advantages over legacy backup and get Veeam for the price of your renewal

Question has a verified solution.

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

Recovering from what the press called "the largest-ever cyber-attack", IT departments worldwide are discussing ways to defend against this in the future. In this process, many people are looking for immediate actions while, instead, they need to tho…
We take a look at some of the most common obstacles that IT teams run into as they work relentlessly to keep all the alarms and sirens from going off at once.
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…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
Suggested Courses

656 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