# CrushTaskExample4

#### Import users from \*.csv file.

If you would like to import users from a \*.CSV file, you can do it based on the following minimal user setup example.

Note that this option to work requires CrushFTP6.4.0_21 and above.\
The WriteFile commands might vary depending on the level of your CSV file complexity. Based on this scenario the Add Before, Add After and Find/Replace should all be entirely empty.\
![Crush Task 4 Write options](CrushTaskExample4/CrushTask4-Write-options.png)

We suggest creating a user as you'd like, and after that edit it's files from the CrushFTP/users/MainUsers/Username folder to see what fields have you selected and set it accordingly based on this example.

￼![Crush Task 4 job](CrushTaskExample4/CrushTask4-job.png)

On the First step we search for the .CSV that contains our users.\
￼![Crush Task 4 find](CrushTaskExample4/CrushTask4-find.png)

On the second step we enter the values, so that CrushFTP will know what values should use in what order from the given CSV.\
￼![Crush Task 4 fileparser](CrushTaskExample4/CrushTask4-fileparser.png)

The following step needs to be done so that it ignores the file found on the first step, and uses the items from the CSV.\
￼![Crush Task 4 ignore](CrushTaskExample4/CrushTask4-ignore.png)

Create the user directory where the user details are stored, and NOT it's actual data.\
￼![Crush Task 4 M Kdir 1](CrushTaskExample4/CrushTask4-MKdir1.png)

On this step we enter the user frame, and make sure you have the \<password>{encrypt_start}{i_password}{encrypt_end}\</password> value.\
￼![Crush Task 4 Write File User](CrushTaskExample4/CrushTask4-WriteFileUser.png)

￼![Crush Task 4 M Kdir 2](CrushTaskExample4/CrushTask4-MKdir2.png)\
￼ Make sure you have the VFS folder always in uppercase, this is a base requirement.\
Another requairement is to have the username with uppercase in the VFS folder, and after that you will have to set the user permissions on the VFS as:\
\<item name="/{upper_start}{i_username}{upper_end}/">(read)(write)(view)(delete)(deletedir)(makedir)(rename)(resume)(share)(slideshow)\</item> ![Crush Task 4 Write File VFS](CrushTaskExample4/CrushTask4-WriteFileVFS.png)\
￼

On the next process we use the HomeFolder path from your CSV and add the users folder to it, where the users actual data will be stored.\
![Crush Task 4 M Kdir 3](CrushTaskExample4/CrushTask4-MKdir3.png)\
￼ On the last step we are creating a a VFS item, that is the XML file pointing to a home folder. It just happened to call this the same way as our username.\
![Crush Task 4 Write File Home Folder](CrushTaskExample4/CrushTask4-WriteFileHomeFolder.png)

You can download the job configuration and slightly adjust the paths in it for your needs.

[attachments](CrushTaskExample4/job.xml) ￼
