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 8714507
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T05:36:48+00:00 2026-06-13T05:36:48+00:00

Could do with some help with this question.I am using the system.io, and I

  • 0

Could do with some help with this question.I am using the system.io, and I have to do things which require files to be moved, grouped, renamed. .

Working in command line application using c# so far I have moved some files from one directory to another, I now need to group some pdf files like so – B-12345 1.pdf, B-12345 2.pdf, B-12345 3.pdf, B-12345 4.pdf.I have been told I dont need to physically group them together just for the purposes of ensuring I only create one job per project reference(b-1234).

To give you a bit of background info on what im doing after these files are grouped I need to create a record in the job table sql database.But thats another question for another day just thought id give you some more info.

Mainly I just need info on how to read files that are in a file directory and grouping files, this would be very beneficial to me.?

To make the question a bit clearer this is the order in tasks should be done in the command line app.

  1. Read files in directory (I have moved them so unsure on this?)
  2. Group by project no (unsure)
  3. Create job record in sql db
  4. Move and rename file to correct location

Thanks in advance

My code is below

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.IO;

public class MoveForProcessing
{
    static void Main()
    {
        // move cad jobs to processing directory and delete former folder, use the System.IO.Path class.
        System.IO.Directory.Move(@"C:\Users\Ben\My Documents\Temp\", @"C:\Users\Ben\My Documents\Processing\");
    }
}
  • 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-13T05:36:50+00:00Added an answer on June 13, 2026 at 5:36 am

    You could first declare a DirectoryInfo class of the dirctory in question

    private System.IO.DirectoryInfo dir = System.IO.DirectoryInfo.Open(@"path");
    

    Then get an array of FileInfo objects for each file in the directory

    private FileInfo[] files = dir.GetFiles();
    

    You could also put a wildcard string into GetFiles() if you want only certain file types

    private FileInfo[] files = dir.GetFiles("*.pdf");
    

    Then you can increment through the array doing whatever you need with each FileInfo object

    foreach(FileInfo f in files)
    {
       f.Move(); // or whatever you need to do
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Could anyone give me some help with this please? The content needs to appear
I could use some help with expression conversion. I have a method on a
i have an issue i could use some help with, i have python list
Its a follow up of this question. https://stackoverflow.com/questions/12260170/how-to-make-a-threadpool-to-be-nonblocking I have achieved it using interface.
I was wondering if i could get some help. What i am trying to
I'm new to SQL and could use some help in creating a database schema
I am really new to Ruby and could use some help with a program.
I'm just starting to learn T-SQL and could use some help in understanding what's
I am fairly new to OOP and wondered if you could provide some help
I'm new here and I hope I could get some help with an Android

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.