Move directories based on names stored in a CSV

Hi there, 
I'm currently attempting to import a CSV file that contains a list of directory names. This list needs to then be checked against the current contents of a second directory (H:\) and all child directories of (H:\) that are listed in the CSV File need to
be moved to another drive (Y:\) 
I have pasted my attempts thus far below, please note that this script does not produce any errors when run, it simply does not copy any files.
# The line below is the path to the inclusions file - one entry per line$inclusions = @()$inclusions = import-csv C:\Users\user\Documents\inclusions1.csv#The line below moves everything that is in the inclusion file.Clear-Variable Directory -ErrorAction SilentlyContinue$Source = Get-ChildItem -Recurse  C:\Users\user\Documents\Script_test1 | sort Name |select name,fullname,lastaccesstime  $destination = "C:\Users\user\Documents\Script_test2\"foreach ($inclusions in $inclusions){ $Source = $Source | Where-Object {$Source.fullname -like "*$inclusion" }$Source | export-csv C:\Users\user\Documents\Files_Moved.csv -Verbosemove-item -path $Source.fullname -destination $destination -whatif -force }
Many thanks 
Tony

What is in the CSV file?  It doesn't look like a CSV file.
CSV File: http://en.wikipedia.org/wiki/Comma-separated_values
¯\_(ツ)_/¯

Similar Messages

  • Drop the files into different directories based on the filename

    Hi,
    I had a reqiuirement based on the file name, i should drop the files in to different directories.
    I can get the filename through variable substitution in receiver file communication channel, now i want to drop the file into different folders based on conditions.
    suppose, if the file name is DDDX234
    i should do substring of filename0+(4), if the value is L then i should drop in X directory
    suppose, if the file name is DDDY234
    i should do substring of filename0+(4), if the value is L then i should drop in Y directory.
    How can i drop the file into differnent directories based on filename.
    Thanks
    Srinivas

    Thanks Michal,
    I mapped the directory and filename to the target header in the mapping
    Filename --> UDF --> Header(target)
    and in the receiver channel checked the ASMA and given * in the filename and directory name.
    But in runtime iam getting the error as
    Attempt to process file failed with com.sap.aii.adapter.file.configuration.DynamicConfigurationException: The Adapter Message Property 'FileName' was configured as mandatory element, but there is no 'DynamicConfiguration' element in the XI Message header
    MY UDF is
    public String Directory(String a,Container container){
    DynamicConfiguration conf = (DynamicConfiguration) container.getTransformationParameters().get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);
    DynamicConfigurationKey key  = DynamicConfigurationKey.create( "http://sap.com/xi/XI/System/File", "FileName");
    DynamicConfigurationKey key1 = DynamicConfigurationKey.create( "http://sap.com/xi/XI/System/File", "Directory");
    String FileName = conf.get(key);
    FileName = a;
    conf.put(key, FileName);
    %%%based on filename the directory should change
    String Directory = conf.get(key1);
    Directory = "/SAPInterface/XI/PPD/DHX/out";
    conf.put(key1, Directory);
    return "";
    Help me in correcting this error.
    Thanks
    Srinivas

  • Using an array name stored in a String in a Statement

    In my sequence, I build an array in one section and store it in a variable called Locals.Test_Array.
    I build the name of the permanent place I would like to store this array and store it in a string called Locals.SG_Test_Array_Name.
    I would like to move the values from Locals.Test_Array to the Station Globals Array name stored in Locals.SG_Test_Array_Name.
    For example:
    the string stored in Locals.SG_Test_Array_Name is "StationGlobals.Coolant_Temperature_Test_Array" (already created in Station Globals)
    What I am trying to do is this:
    Statement                        StationGlobals.Coolant_Temperature_Test_Array=Loca​ls.Test_Array  (this works)
    The Station Global Array name needs to change as the sequence executes and the data in Locals.Test_Array changes.
    What I need is something like this.
    Statement                         Locals.SG_Test_A​rray_Name=Locals.Test_Array  (where SG_Test_Array_Name is a string that holds the name of the array)
    Thanks, Big_Will

    Evaluate(Locals.SG_Test_Array_Name + " = Locals.Test_Array " )

  • Dynamic sql and block based on a stored procedure

    Hi!
    I'm triying to generate a block based on a stored procedure. I want the stored procedure to execute a dynamic sql, but I'm having getting the error "PLS-00455 cursor 'AULOCASLATE' cannot be used in dynamic SQL OPEN statement".
    I have the following code:
    CREATE OR REPLACE package pkg_f0015 is
    type rClieInstSlate is record
    (clie_id CMS_CLIENTS.ID%type
    ,client_nm varchar2(1000)
    ,cs_no CMS_CLIENTS.CS_NO%type
    ,dob CMS_CLIENT_NAMES.BIRTH_DT%type);
    type tClieInstSlate is table of rClieInstSlate;
    type uClieInstSlate is ref cursor return rClieInstSlate;
    procedure prLocationSlateQry(
    auLocaSlate in out uClieInstSlate,                anCsNo in CMS_CLIENTS.CS_NO%type,
    avClieNm in varchar2,
    avSearchType in varchar2,
    avLotyCd in CMS_LOCATION_TYPES.CD%type);
    end pkg_f0015;
    CREATE OR REPLACE PACKAGE BODY pkg_cms_f0015 is
    procedure PRLocationSlateQry( auLocaSlate in out uClieInstSlate,
    anCsNo in CMS_CLIENTS.CS_NO%type,
    avClieNm in varchar2,
    avSearchType in varchar2,
    avLotyCd in CMS_LOCATION_TYPES.CD%type) IS
    vSelect varchar2(5000);
    vAddCond varchar2(1000);
    vSupLevel varchar2(50);
    begin
    vSelect := 'select clie.ID,'||
    ' CLIENT_NAME,'||
    ' clie.CS_NO,'||
    ' clna.BIRTH_DT dob'
    ' from CMS_CLIENT_NAMES clna,'||
    'CMS_CLIENTS clie'||
    ' where clna.CLIE_ID = clie.ID';
    if avSearchType= 'C' then
    vAddCond := ' and clie.CS_NO = nvl('||anCsNo||',clie.CS_NO)';
    vSelect := vSelect || vAddCond;
    open auLocaSlate for vSelect;
    end if;
    end PRLocationSlateQry;
    end;
    I wonder if what I want is possible

    OK,
    Now it works. Previously we had the parameter p_guid declared as RAW, which obviously is not any good. :)
    Radovan
    Edited by: biciste on Apr 28, 2009 4:57 PM

  • How do I get data to the from in a form based on a stored procedure

    I would like to create a form based on a stored procedure. I have bound LOV's that lookup the ID of the data that is to be displayed on the form. Then I have a button that reads the database and populates the fields on the form. This is our current UI standard on our portal site, and I need to copy that UI exactly in order to mix HTML DB code with our current portal code because we can not afford to re-write all our code in portal to HTML DB. Can this be done, and how can it be done? Thanks

    We are developing an entire HR system for our organization using portal forms. I am trying to prototype in HTML DB to see if we can switch our future development to this new product. However, we already have 50 or so forms that follow a certain user interface look and feel in portal. I am trying to create this interface look and feel in HTML DB. What we are doing in Portal is have a lookup section at the top of each form where you find the record you want to update with LOV's, sometimes 2 or 3 bound together, and then have a lookup button that does PL/SQL to read the database and populate the fields on the form. Then there is an Update button at the end of the form that takes the fields off the form and passes them to a stored procedure. I can not figure out how to do the Lookup button type of code to read information and bring it to the form when doing a form based on a stored procedure.

  • Using field names stored in the database in a query

    Hi,
    I'm working on a database that has field names stored in tables. In order to construct a query using the field names stored in the table, normally I'd use dynamic SQL. 
    For example in table1 I have
    Field_Name Value
    Field1
    'Name'
    Field 2
           'Address'
    I want to build a select statement  "SELECT Name, Address, FROM tblCustTable" - if possible not using dynamic SQL.
    Is there a neat way to do this?
    Thanks very much.
    Sad old developer

    No, it is not possible to dynamically include ANY object names (Columns, Tables, Functions, Procedures, etc) in SQL without using Dynamic SQL.
    The closest you can get, if you are choosing from a known set of names, is to use CASE statements:
    SELECT CASE
    WHEN t1.Field1='Name' THEN ct.[Name]
    WHEN t1.Field1='Address' THEN ct.[Address]
    END AS Field1
    FROM tblCustTable ct
    CROSSJOIN table1 t1
    WHERE ...
    However there are several disadvantages to this approach, and the SQL will quickly get very convoluted and difficult to maintain.   Dynamic SQL is much cleaner.
    -Tab Alleman

  • Are TableSpace names stored in the tables?

    Are TableSpace names stored in the tables?
    If so, which one?

    Tablespaces are stored in the db.
    I believe they are in tCtrlOption

  • Simply shading an entire County based on name

    Hello,
    So, I have data which gets pulled via a macro. I have recently been upgraded to MS 2013 and have been messing around with the Power Map addon.  My question, I want to simply shade counties that are present in data based on name. I see that just putting
    the data in gives a small square box on top of the county in the country map, but I am looking at doing it by state with specific counties shaded in. Example:
    FRANKLIN
    FL
    JACKSON
    FL
    MADISON
    FL
    POLK
    FL
    PUTNAM
    FL
    UNION
    FL
    WALTON
    FL
    BANKS
    GA
    BARROW
    GA
    I would want all these counties to be shaded, but the WHOLE county, not just a small colored box.  Past this, is there a way to get a specific state to display instead of the whole world?  The end goal would be to pull the state image with the
    shaded counties to word with a macro.
    Thank you!

    Hi,
    This is the forum to discuss questions and feedback for Microsoft Excel, your issue is related to Excel macro code, I recommend you post the question to the MSDN forum for Excel
    http://social.msdn.microsoft.com/Forums/en-US/home?forum=exceldev&filter=alltypes&sort=lastpostdesc
    The reason why we recommend posting appropriately is you will get the most qualified pool of respondents, and other partners who read the forums regularly can either share their knowledge or learn from your interaction with us. Thank you for your understanding.
    George Zhao
    TechNet Community Support
    It's recommended to download and install
    Configuration Analyzer Tool (OffCAT), which is developed by Microsoft Support teams. Once the tool is installed, you can run it at any time to scan for hundreds of known issues in
    Office programs.

  • How to create directories with same name in different schemas

    I have two schemas on the same database.
    I am trying to create directories with same name, but different paths in both the schemas.
    When i created the directories in second schema, the directory paths of the first schema are automatically changed to the second path.
    Is there any solution to create directories with same name, but different path in two different schemas on the same database.
    Thanks,
    Sridhar.

    Hi,
    >>When i created the directories in second schema, the directory paths of the first schema are automatically changed to the second path.
    If you have removed the REPLACE clause of your create statement, then you would see that is not possible.
    SYSTEM> connect scott/tiger
    Connected.
    SCOTT> create directory mydir as '/tmp';
    Directory created.
    SCOTT> connect legatti/pwd
    Connected.
    LEGATTI> create directory mydir as '/tmp';
    create directory mydir as '/tmp'
    ERROR at line 1:
    ORA-00955: name is already used by an existing object
    LEGATTI> select owner,object_name,object_type,created
      2  from dba_objects where object_name='MYDIR';
    OWNER     OBJECT_NAME    OBJECT_TYPE         CREATED
    SYS       MYDIR          DIRECTORY           19/12/2007Cheers
    Legatti

  • How to create logical directories with same name on two databases

    Hi,
    OS: Windows
    Oracle Version : 10g
    I have to databases in one oracle home. I have created some logical directories in one database. When I am trying to create logical directories with same name in another database, it is overwriting the first database directory paths with the second one
    Can't we create directories with same name but different path in two databases on one machine?
    Pls suggest me on this
    Regards,
    Vijay

    I am trying to create logical directory using CREATE
    DIRECTORY statement. I am very much aware that the
    create directory statement doesn't create directory
    on OS. But we can attach the physical directory on OS
    to logical directory in oracle
    My requirement is to create logical directories in
    oracle mapping the OS directories. Both the
    databases, wil have same logical directory names but
    different OS directory mappingsIf I understand you correctly, you can do this:
    On DB 1
    CREATE OR REPLACE DIRECTORY same_dir_name as 'C:\myoracle\mydir1';
    On DB 2
    CREATE OR REPLACE DIRECTORY same_dir_name as 'D:\myoracle\mydir2';
    What stops you from doing that ?
    Note: If what you have is one database but different connections, then you are connecting to one database. The above second statement will drop and replace with the first one

  • Urgent----In which table are portlet id and name stored?

    In which table are portlet-id and name stored?

    portal30.WWPRO_PORTLET_METADATA_NLS$
    portal30.WWPRO_PORTLET_METADATA$
    portal30.WWPOB_PORTLET_INSTANCE$

  • Multiple Corporate Directories based on DP CM 4.0

    We have a sister company and I want to create seperate Corporate Directories based on device pool or css on Callmanager 4.0

    Roy,
    You cannot set the corporate directory at a Device Pool level, only Enterprise Parameters for affecting multiple phones. At the user level you can assign a directory url per phone. You can bulk these settings to a phone via the device pool search in BAT. The negative to this is that phones could be added later without the correct information. Also this setup requires two LDAP servers configured with your user information or a common one with some default search base configured differently in the ASP pages. You would need to copy and adjust the original corporate directory asp pages to accomodate the two different LDAP stores or LDAP configuration. The appropriate page would be referenced by the appropriate user group. Example User Group A phones would be configured with http://webserver/CCMCIP/xmldirectoryGroupA.asp and User Group B Phones would be configured with http://webserver/CCMCIP/xmldirectoryGroupB.asp. Your CCM would still be integrated to one LDAP store (DCD, AD, etc.) but your directory services would use a different LDAP.
    If you do this then I would recommend you set your standard directories enterprise parameter to a web page that says the users directory is not configured. That way if a new phone is added without a directory the user would get a friendly page that tells them to call the help desk to get the correct corporate directory setup.
    Here is the link describing just directory access via HTTP.
    http://www.cisco.com/en/US/products/sw/voicesw/ps556/products_administration_guide_chapter09186a00803edaa5.html#wp1056718
    Please rate any helpful posts
    Thanks
    Fred

  • Searching for movie data in file Name-FIN-00000001

    While starting up FCP (6.0.6) gives an error message "Searching for movie data in file Name-FIN-00000001".
    After 10 to 20 min FCP will start up.
    How do I get rid of this annoying error message when starting up?
    Thanks W.

    As Jim says, this is a render file. However, simply rendering it won't fix this. What is causing this error is a QT reference movie in the project. When you export a QT movie, and make don't make it self contained, it is a reference movie that references media files and render files. When a render file is deleted (FCP does this automatically when the render file is no longer needed) then the refrerence movie can no longer function... one file it references is gone. Simply re-rendering won't fix it, because it is referencing that SPECIFIC render file.
    You need to find and delete the QT Reference movie from your project.
    Shane

  • I have a task, that is i want to retrive the details from active directory based on name and i want show that details into grid view.

    Hi All,
    I have a task, that is i want to retrive the details from active directory based on name and i want show that details into grid view.
    Can any one help how to start.
    Thanks in advance!

    Hi AnilKarthik,
    You can get user details by name using DirectoryService namespace. Then you can create a DataTable to restore the information and then bind to the SharePoint GridView.
    Here are some deatiled code demos for your reference:
    how to get userdetails from Active Directory based on username using asp.net:
    http://www.aspdotnet-suresh.com/2011/03/how-to-get-userdetails-from-active.html
    How to get User Data from the Active Directory:
    http://www.codeproject.com/Articles/6778/How-to-get-User-Data-from-the-Active-Directory
    Using SPGridView to bound to list data in SharePoint:
    http://nishantrana.me/2009/03/23/using-spgridview-to-bound-to-list-data-in-sharepoint/
    Best Regards
    Zhengyu Guo
    TechNet Community Support

  • Filter an XMLList based on values stored in an arary

    Basically what I want to do is remove elements with in my
    XMLList if the node contains a specific value. The catch is that
    value could be a multiple number of different values.
    For example I have an XMLList that has several items:
    <item id="200">
    <url>some.swf</url>
    <image>image.jpg</image>
    <owner id="123" name="Some Company">
    </item>
    <item id="201">
    <url>some.swf</url>
    <image>image.jpg</image>
    <owner id="123" name="Some Company Again">
    </item>
    Then I have an Array that is storing the Companies that I
    want filtered out of the XMLList .. example:
    filterArray[0] = "Company X";
    filterArray[1] = "Some Company";
    I don't know how many indexes the array will have. What I
    want to do is delete any item in the XMLList that has a owner.@name
    that is equal to any name stored in any index of the Array. I have
    no idea where to start with this. Any help would be great!

    I'd create a filter function, and in that function, loop over
    the array, comparing values.
    You can do something like this:
    var xl:XMLList = xmlItems.item.(!isExcluded(*));
    private function isExcluded(xmlItem:XML):Boolean {
    var bExcluded:Boolean = false;
    var sOwnerName:String = xmlItem.owner.text();
    for (var i:int=o;i<aCompanies.length;i++) {
    if (aCompanies [ i ] == sOwnerName) {
    bExcluded = true;
    break;
    return bExcluded;
    Tracy

Maybe you are looking for

  • Need help with backed up photos-now cannot view..?

    Using iphoto 6, super duper, seagate external hd. Drive has already been set-up and backed up several times-been working well........until....... Last night, I saw that out of 120gb I have about 5gb left on my G4.! "decided" to back-up iphotos and "d

  • Can JSC support Sun App Server 9?

    Does anyone know if JSC can support sun app server 9? Last I heard was that 8.2 is the max version. Along the same line, is there any word of another update to JSC that will work with app server 9 and jdk 6???

  • Dynamic DB table name in insert statement

    In the following command i was able to build <dyn_table> dynamically but how do we do that for <dyn_wa>. table name should be populated dynamically here. for ex: pa0001, pa0002, .... and I have these names in an IT table INSERT  <dyn_wa> FROM TABLE <

  • Questions on Named Query

    We have a few questions about named query. According to the Toplink documentation, we can register the named query in 2 places. 1. Register the name query in the “query manager” in a Session level - The documentation said that these are for “GLOBAL”

  • Selecting rows from a JTable using keys

    Hi all, be very grateful for some help on this. I want to provide functionality in an application where the user will be able to select multiple rows from a JTable by using the page up/ page down button. Anybody know how this can be done? Thanks