Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8761025
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T15:11:29+00:00 2026-06-13T15:11:29+00:00

I have around 50 xml files that are newly generated everytime I run a

  • 0

I have around 50 xml files that are newly generated everytime I run a particular logic. Now I want these 50 files to be stored inside a particular date-time folder. No matter how many times ever I run that logic for one particular date, the xml files should be overwritten for that particular date only (based on the hhmmss). In simple , How to create a folder using a name based on the current date and store the xml files in them depending on the date?

For Eg: there are 3 xml files
file_1.xml, file_2.xml and file_3.xml

Now I want a folder to be created in the format-

**xml_yyyymmdd_hhmmss** 

that would house all the xml files in them.

For Eg: Xml_20121029_180912 

would be the folder created for today’s date. And all the 3 xml files will be stored in this for today.

For tomorrow the folder name would be:

Xml_20121030_170912 

My code looks like below:

$location = New-Item -Path . -ItemType Directory -Name ("XML_$(Get-Date -f dd_MM_yyyy_hhmmss)")
$rptdir = "C:\Test" 
$ rptdir = ($rptdir + '\' + $location.Name)
$outputFile= "$rptdir\File_2.xml"
$row = "\\shared\Data\DevSB\CS\appSomeSystem.dll"   
& /f:$row /o:$outputFile

Output Error: Could not find part of the path “C:\test\XML_29_10_2012_091717\File2.xml.

The issue here is- The folder XML_29_10_2012_091717 is created with File2.xml in it but not inside the C:\Test but where the script is.

I need XML_29_10_2012_091717 to be created in C:\test with File2.xml inside it.

Environment: Win Xp Professional.

Any help would be greatly appreciated.

Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T15:11:30+00:00Added an answer on June 13, 2026 at 3:11 pm

    Try this:

    New-Item -Path . -ItemType Directory -Name ("XML_$(Get-Date -f ddMMyyyy_hhmmss)")
    

    Edit after comments:

    try changing this:

    $location = New-Item -Path c:\test -ItemType Directory -Name ("XML_$(Get-Date -f dd_MM_yyyy_hhmmss)")
    $outputFile= "$($location.fullname)\File_2.xml"
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an application that fetches announcements stored as xml files on a server
We have about 1400 xml files which we use to store data around the
I have around 100 PNGs (that I created) that I want to create an
I have around 100 rows of text that I want to tokenize, which are
I have a bunch of .xml files with nodes that are causing uncessesary complications.
I've been given some XML files that don't quite have a proper schema (I
I have a directory A with a bunch of files with .xml extension that
I have XML files stored in BLOB storage, and I am trying to figure
I have a number of services that read xml files. To make sure that
I have some XML files that I do a weekly import from for one

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.